Skip to content

Commit

Permalink
chore: add wrap method
Browse files Browse the repository at this point in the history
  • Loading branch information
tejmagar committed Jun 9, 2024
1 parent 8dd3a7b commit 7f38f59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/forms/fields/input_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use tokio::sync::Mutex;

use crate::core::forms::{Files, FormData};

use crate::forms::AbstractFields;
use crate::forms::fields::FieldResult;
use crate::forms::AbstractFields;

#[derive(Clone)]
pub struct InputField {
Expand Down Expand Up @@ -88,4 +88,8 @@ impl AbstractFields for InputField {
Ok(())
}))
}

fn wrap(&self) -> Box<dyn AbstractFields> {
Box::new(self.clone())
}
}
2 changes: 1 addition & 1 deletion src/forms/fields/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub trait AbstractFields {
form_data: &mut FormData,
files: &mut Files,
) -> FieldResult<Result<(), Vec<String>>>;
fn wrap(&self) -> Box<Self>;
fn wrap(&self) -> Box<dyn AbstractFields>;
}

pub type FormFields = Vec<Box<dyn AbstractFields>>;
Expand Down

0 comments on commit 7f38f59

Please sign in to comment.