Trait anansi_core::forms::Form

source ·
pub trait Form {
    type Data: Clone + Send;

Show 21 methods // Required methods fn new() -> Self where Self: Sized; fn attrs(&self) -> &Attributes; fn csrf_token(&self) -> Option<&String>; fn insert_attr(self, key: &str, value: &str) -> Self where Self: Sized; fn post(&mut self, token: &TokenRef<'_>); fn from_data<'async_trait>( data: Self::Data ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>> where Self: Sized + 'async_trait; fn from_get<B: BaseRequest>(req: &mut B) -> Result<Self> where Self: Sized; fn from_post<B: BaseRequest + CsrfDefense>(req: &mut B) -> Result<Self> where Self: Sized; fn fill(&mut self) -> Result<()> where Self: Sized; fn validate(&mut self) -> Result<Self::Data>; fn errors(&self) -> &FormErrors; fn add_error(&mut self, e: Box<dyn Error + Send + Sync>); fn set_data(&mut self, data: Option<Self::Data>); fn field_names() -> &'static [&'static str]; fn field(&self, n: usize) -> Option<&dyn Field>; // Provided methods fn token_tag(&self) -> Option<String> { ... } fn tag(&self) -> String { ... } fn action<B: BaseRequest + Reverse>(self, req: &B, action: View<B>) -> Self where Self: Sized { ... } fn class(self, class: &str) -> Self where Self: Sized { ... } fn id(self, id: &str) -> Self where Self: Sized { ... } fn submit(&self, value: &str) -> String { ... }
}

Required Associated Types§

Required Methods§

source

fn new() -> Selfwhere Self: Sized,

source

fn attrs(&self) -> &Attributes

source

fn csrf_token(&self) -> Option<&String>

source

fn insert_attr(self, key: &str, value: &str) -> Selfwhere Self: Sized,

source

fn post(&mut self, token: &TokenRef<'_>)

source

fn from_data<'async_trait>( data: Self::Data ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where Self: Sized + 'async_trait,

source

fn from_get<B: BaseRequest>(req: &mut B) -> Result<Self>where Self: Sized,

source

fn from_post<B: BaseRequest + CsrfDefense>(req: &mut B) -> Result<Self>where Self: Sized,

source

fn fill(&mut self) -> Result<()>where Self: Sized,

source

fn validate(&mut self) -> Result<Self::Data>

source

fn errors(&self) -> &FormErrors

source

fn add_error(&mut self, e: Box<dyn Error + Send + Sync>)

source

fn set_data(&mut self, data: Option<Self::Data>)

source

fn field_names() -> &'static [&'static str]

source

fn field(&self, n: usize) -> Option<&dyn Field>

Provided Methods§

source

fn token_tag(&self) -> Option<String>

source

fn tag(&self) -> String

source

fn action<B: BaseRequest + Reverse>(self, req: &B, action: View<B>) -> Selfwhere Self: Sized,

source

fn class(self, class: &str) -> Selfwhere Self: Sized,

source

fn id(self, id: &str) -> Selfwhere Self: Sized,

source

fn submit(&self, value: &str) -> String

Implementors§