pub(crate) fn mailbox(input: &[u8]) -> IResult<&[u8], Mailbox> {
    let (remaining, mailbox) = astring(input)?;

    let mailbox = match mailbox {
        astr::Atom(str) => {
            if str.to_lowercase() == "inbox" {
                Mailbox::Inbox
            } else {
                Mailbox::Other(mailbox.to_owned())
            }
        }
        astr::String(ref imap_str) => match imap_str {
            istr::Quoted(ref str) => {
                if str.to_lowercase() == "inbox" {
                    Mailbox::Inbox
                } else {
                    Mailbox::Other(mailbox.to_owned())
                }
            }
            istr::Literal(bytes) => {
                // "INBOX" (in any case) is certainly valid ASCII/UTF-8...
                if let Ok(str) = std::str::from_utf8(bytes) {
                    // After the conversion we ignore the case...
                    if str.to_lowercase() == "inbox" {
                        // ...and return the Inbox variant.
                        Mailbox::Inbox
                    } else {
                        Mailbox::Other(mailbox.to_owned())
                    }
                } else {
                    // ... If not, it must be something else.
                    Mailbox::Other(mailbox.to_owned())
                }
            }
        },
    };

    Ok((remaining, mailbox))
}
/// INBOX is case-insensitive. All case variants of INBOX (e.g., "iNbOx")
/// MUST be interpreted as INBOX not as an astring.
///
/// An astring which consists of the case-insensitive sequence
/// "I" "N" "B" "O" "X" is considered to be INBOX and not an astring.
///
/// Refer to section 5.1 for further semantic details of mailbox names.
///
/// mailbox = "INBOX" / astring
INBOX is case-insensitive. All case variants of INBOX
MUST be interpreted as INBOX not as an astring.



Refer to section 5.1 for further semantic details of mailbox names.

mailbox = "INBOX" / astring
INBOX is case - insensitive . All case variants of INBOX MUST be interpreted as INBOX not as an astring . Refer to section 5 . 1 for further semantic details of mailbox names . mailbox = " INBOX " / astring
pub(crate) fn mailbox(input: &[u8]) -> IResult<&[u8], Mailbox> {
    let (remaining, mailbox) = astring(input)?;
    let mailbox = match mailbox {
        astr::Atom(str) => {
            if str.to_lowercase() == "inbox" {
                Mailbox::Inbox
            } else {
                Mailbox::Other(mailbox.to_owned())
            }
        }
        astr::String(ref imap_str) => match imap_str {
            istr::Quoted(ref str) => {
                if str.to_lowercase() == "inbox" {
                    Mailbox::Inbox
                } else {
                    Mailbox::Other(mailbox.to_owned())
                }
            }
            istr::Literal(bytes) => {
                // "INBOX" (in any case) is certainly valid ASCII/UTF-8...
                if let Ok(str) = std::str::from_utf8(bytes) {
                    // After the conversion we ignore the case...
                    if str.to_lowercase() == "inbox" {
                        // ...and return the Inbox variant.
                        Mailbox::Inbox
                    } else {
                        Mailbox::Other(mailbox.to_owned())
                    }
                } else {
                    // ... If not, it must be something else.
                    Mailbox::Other(mailbox.to_owned())
                }
            }
        },
    };
    Ok((remaining, mailbox))
}
pub ( crate ) fn mailbox ( input : & [ u8 ] ) -> IResult < & [ u8 ] , Mailbox > { let ( remaining , mailbox ) = astring ( input ) ? ; let mailbox = match mailbox { astr :: Atom ( str ) => { if str . to_lowercase ( ) == " " { Mailbox :: Inbox } else { Mailbox :: Other ( mailbox . to_owned ( ) ) } } astr :: String ( ref imap_str ) => match imap_str { istr :: Quoted ( ref str ) => { if str . to_lowercase ( ) == " " { Mailbox :: Inbox } else { Mailbox :: Other ( mailbox . to_owned ( ) ) } } istr :: Literal ( bytes ) => { // "INBOX" (in any case) is certainly valid ASCII/UTF-8... if let Ok ( str ) = std :: str :: from_utf8 ( bytes ) { // After the conversion we ignore the case... if str . to_lowercase ( ) == " " { // ...and return the Inbox variant. Mailbox :: Inbox } else { Mailbox :: Other ( mailbox . to_owned ( ) ) } } else { // ... If not, it must be something else. Mailbox :: Other ( mailbox . to_owned ( ) ) } } } , } ; Ok ( ( remaining , mailbox ) ) }
INBOX is case-insensitive.
INBOX is case - insensitive .
input
&[u8]