Trait rama::username::UsernameLabelParser
pub trait UsernameLabelParser:
Default
+ Send
+ Sync
+ 'static {
type Error: Into<Box<dyn Error + Sync + Send>>;
// Required methods
fn parse_label(&mut self, label: &str) -> UsernameLabelState;
fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>;
}
Expand description
A parser which can parse labels from a username.
Default
is to be implemented for every UsernameLabelParser
,
as it is what is used to create the parser instances for one-time usage.
Required Associated Types§
Required Methods§
fn parse_label(&mut self, label: &str) -> UsernameLabelState
fn parse_label(&mut self, label: &str) -> UsernameLabelState
Interpret the label and return whether or not the label was recognised and valid.
UsernameLabelState::Ignored
should be returned in case the label was not recognised or was not valid.
fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>
fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>
Consume self and store/use any of the relevant info seen.
Object Safety§
This trait is not object safe.