Trait UsernameLabelParser
pub trait UsernameLabelParser:
Default
+ Send
+ Sync
+ 'static {
type Error: Into<Box<dyn Error + Send + Sync>>;
// Required methods
fn parse_label(&mut self, label: &str) -> UsernameLabelState;
fn build(self, ext: &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: &Extensions) -> Result<(), Self::Error>
fn build(self, ext: &Extensions) -> Result<(), Self::Error>
Consume self and store/use any of the relevant info seen.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".