Open asonix opened 5 years ago
Something like
pub trait FormWithState { type State; fn as_state(&self) -> Self::State; } impl FormWithState for CreatePostForm { type State = CreatePostFormState; fn as_state(&self) -> Self::State { CreatePostFormState { ... } } }
And this could even be automated with proc_macros like this
#[derive(FormWithState)] pub struct CreatePostForm { name: Option<String>, #[form_with_state(ignore)] csrf_token: String, ... }
Something like
And this could even be automated with proc_macros like this