duesee / imap-codec

Rock-solid and complete codec for IMAP
Apache License 2.0
35 stars 13 forks source link

feat: Implement `FromStr` for `AuthMechanism` #390

Closed duesee closed 5 months ago

duesee commented 7 months ago

Oh, we can't as we want... FromStr can't return anything with a reference to the input string.

impl FromStr for AuthMechanism<'static> {
    type Err = ValidationError;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        AuthMechanism::try_from(s.to_string())
    }
}

Close enough? See v2 branch.