Trait UsernameLabelParser

Source
pub trait UsernameLabelParser:
    Default
    + Send
    + Sync
    + 'static {
    type Error: Into<BoxError>;

    // 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§

Source

type Error: Into<BoxError>

Error which can occur during the building phase.

Required Methods§

Source

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.

Source

fn build(self, ext: &mut 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", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl UsernameLabelParser for ()

Source§

type Error = Infallible

Source§

fn parse_label(&mut self, _label: &str) -> UsernameLabelState

Source§

fn build(self, _ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1> UsernameLabelParser for (T1,)
where T1: UsernameLabelParser<Error: Into<BoxError>>,

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2> UsernameLabelParser for (T1, T2)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3> UsernameLabelParser for (T1, T2, T3)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4> UsernameLabelParser for (T1, T2, T3, T4)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4, T5> UsernameLabelParser for (T1, T2, T3, T4, T5)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4, T5, T6> UsernameLabelParser for (T1, T2, T3, T4, T5, T6)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4, T5, T6, T7> UsernameLabelParser for (T1, T2, T3, T4, T5, T6, T7)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8> UsernameLabelParser for (T1, T2, T3, T4, T5, T6, T7, T8)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> UsernameLabelParser for (T1, T2, T3, T4, T5, T6, T7, T8, T9)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> UsernameLabelParser for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> UsernameLabelParser for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> UsernameLabelParser for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

Source§

type Error = OpaqueError

Source§

fn parse_label(&mut self, label: &str) -> UsernameLabelState

Source§

fn build(self, ext: &mut Extensions) -> Result<(), Self::Error>

Implementors§

Source§

impl UsernameLabelParser for UsernameOpaqueLabelParser

Source§

impl<T1> UsernameLabelParser for ExclusiveUsernameParsers<(T1,)>
where T1: UsernameLabelParser<Error: Into<BoxError>>,

Source§

impl<T1, T2> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2)>

Source§

impl<T1, T2, T3> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3)>

Source§

impl<T1, T2, T3, T4> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4)>

Source§

impl<T1, T2, T3, T4, T5> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4, T5)>

Source§

impl<T1, T2, T3, T4, T5, T6> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4, T5, T6)>

Source§

impl<T1, T2, T3, T4, T5, T6, T7> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4, T5, T6, T7)>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4, T5, T6, T7, T8)>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4, T5, T6, T7, T8, T9)>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)>

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> UsernameLabelParser for ExclusiveUsernameParsers<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)>