I need a "default", de facto an empty struct that I will be returning as a default value. Since it is read only, I don't want to pollute the memory by creating it N times, but rather return it only once
#[derive(Debug,PartialEq)]
pub struct Vocabulary {
literal_names: Vec<String>,
symbolic_names: Vec<String>,
display_names: Vec<String>,
max_toke_type: usize,
}
static EMPTY_VOCABULARY:Vocabulary = Vocabulary{
literal_names: Vec::new(),
symbolic_names: Vec::new(),
display_names: Vec::new(),
max_toke_type: 0 ,
};
This fails, considering function calls are not allowed in static context. How can I initialized these fields then?