#[derive(Debug,Clone,Builder)]
#[builder(build_fn(validate = "Self::validate"))]
pub struct FileParametres{
#[builder(public)]
eq_type:i8,
#[builder(default = "(0 as f32,1 as f32)")]
margin_domain:(f32,f32),
time_eval_period_stage:(f32,f32),
pub bound_type:i8,
pub init_type:i8,
pub init_conditions:(i32,i32,Option<i32>),
pub quantity_split_nodes:u32,
#[builder(setter(into))]
pub n_corant:f32,
pub add_arg: Option<TypeTsk>,//will be last
}
//Специфика введенного первого аргумента (типа уравнения)
#[derive(Debug,Clone)]
pub enum TypeTsk{
Burger{b:String},
Transfer{a:f32},
}
//Конструктор структуры
impl FileParametres {
fn validate(&self) -> Result<(), String>{
if let ref eq_type = self.eq_type {
match *eq_type {
i if i < 0 => Err("Less than 0".to_string()),
i if i > 1 => Err("More than one".to_string()),
_ => Ok(())
}
} else {
Ok(())
}
}
}
Something wrong with validate function:
no function or associated item named validate found for struct FileParametresBuilder in the current scope
function or associated item validate not found for this