/// Tries to parse a badge from this message part
Tries to parse a badge from this message part
Tries to parse a badge from this message part
pub fn parse(input: &'t str) -> Option<Badge<'t>> {
        use BadgeKind::*;
        let mut iter = input.split('/');
        let kind = match iter.next()? {
            "admin" => Admin,
            "bits" => Bits,
            "broadcaster" => Broadcaster,
            "global_mod" => GlobalMod,
            "moderator" => Moderator,
            "subscriber" => Subscriber,
            "staff" => Staff,
            "turbo" => Turbo,
            "premium" => Premium,
            "vip" => VIP,
            "partner" => Partner,
            badge => Unknown(Cow::Borrowed(badge)),
        };
        iter.next().map(|data| Badge {
            kind,
            data: Cow::Borrowed(data),
        })
    }
pub fn parse ( input : & ' t str ) -> Option < Badge < ' t > > { use BadgeKind :: * ; let mut iter = input . split ( '/' ) ; let kind = match iter . next ( ) ? { " " => Admin , " " => Bits , " " => Broadcaster , " " => GlobalMod , " " => Moderator , " " => Subscriber , " " => Staff , " " => Turbo , " " => Premium , " " => VIP , " " => Partner , badge => Unknown ( Cow :: Borrowed ( badge ) ) , } ; iter . next ( ) . map ( | data | Badge { kind , data : Cow :: Borrowed ( data ) , } ) }
Tries to parse a badge from this message part
Tries to parse a badge from this message part
input
&'t str