#[builder(build_fn(validate = "Self::validate"))]


#[builder(build_fn(validate = "Self::validate"))]

pub struct FileParametres{



    #[builder(default = "(0 as f32,1 as f32)")]



    pub bound_type:i8,

    pub init_type:i8,

    pub init_conditions:(i32,i32,Option<i32>),

    pub quantity_split_nodes:u32,


    pub n_corant:f32,

    pub add_arg: Option<TypeTsk>,//will be last


//Специфика введенного первого аргумента (типа уравнения)


pub enum TypeTsk{




//Конструктор структуры

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 {




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

- impl FileParametres {
+ impl FileParametresBuilder {

    fn validate(&self) -> Result<(), String>{

-        if let ref eq_type = self.eq_type {
+        if let Some(ref eq_type) = self.eq_type {

makes it compile for me.

Yes, it's what is needed,thanks much)

Also,do you know method that replace no more than * characters?)

I don’t understand what you’re asking for. Please try to be a bit more specific.

' ... '.replace(' ', '*') but i want delete only one whitespace)

There's replacen for that.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.