added fields to the traits
This commit is contained in:
@@ -9,6 +9,7 @@ pub trait CanvasState {
|
||||
fn inputs(&self) -> Vec<&String>;
|
||||
fn get_current_input(&self) -> &str;
|
||||
fn get_current_input_mut(&mut self) -> &mut String;
|
||||
fn fields(&self) -> Vec<&str>;
|
||||
}
|
||||
|
||||
// Implement for FormState (keep existing form.rs code and add this)
|
||||
@@ -41,4 +42,8 @@ impl CanvasState for FormState {
|
||||
.get_mut(self.current_field)
|
||||
.expect("Invalid current_field index")
|
||||
}
|
||||
|
||||
fn fields(&self) -> Vec<&str> {
|
||||
self.fields.iter().map(|s| s.as_str()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,4 +57,8 @@ impl CanvasState for AuthState {
|
||||
_ => panic!("Invalid current_field index in AuthState"),
|
||||
}
|
||||
}
|
||||
|
||||
fn fields(&self) -> Vec<&str> {
|
||||
vec!["Username/Email", "Password"]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user