fn type_bits(ty: &Ident) -> Result<u8, syn::Error> {
    // This would be so much easier if we could just match on an Ident...
    if ty == "usize" {
        Err(syn::Error::new_spanned(
            ty,
            "#[repr(usize)] is not supported. Use u32 or u64 instead.",
        ))
    } else if ty == "i8"
        || ty == "i16"
        || ty == "i32"
        || ty == "i64"
        || ty == "i128"
        || ty == "isize"
    {
        Err(syn::Error::new_spanned(
            ty,
            "Signed types in a repr are not supported.",
        ))
    } else if ty == "u8" {
        Ok(8)
    } else if ty == "u16" {
        Ok(16)
    } else if ty == "u32" {
        Ok(32)
    } else if ty == "u64" {
        Ok(64)
    } else if ty == "u128" {
        Ok(128)
    } else {
        Err(syn::Error::new_spanned(
            ty,
            "repr must be an integer type for #[bitflags].",
        ))
    }
}
/// Check the repr and return the number of bits available
Check the repr and return the number of bits available
Check the repr and return the number of bits available
fn type_bits(ty: &Ident) -> Result<u8, syn::Error> {
    // This would be so much easier if we could just match on an Ident...
    if ty == "usize" {
        Err(syn::Error::new_spanned(
            ty,
            "#[repr(usize)] is not supported. Use u32 or u64 instead.",
        ))
    } else if ty == "i8"
        || ty == "i16"
        || ty == "i32"
        || ty == "i64"
        || ty == "i128"
        || ty == "isize"
    {
        Err(syn::Error::new_spanned(
            ty,
            "Signed types in a repr are not supported.",
        ))
    } else if ty == "u8" {
        Ok(8)
    } else if ty == "u16" {
        Ok(16)
    } else if ty == "u32" {
        Ok(32)
    } else if ty == "u64" {
        Ok(64)
    } else if ty == "u128" {
        Ok(128)
    } else {
        Err(syn::Error::new_spanned(
            ty,
            "repr must be an integer type for #[bitflags].",
        ))
    }
}
fn type_bits ( ty : & Ident ) -> Result < u8 , syn :: Error > { // This would be so much easier if we could just match on an Ident... if ty == " " { Err ( syn :: Error :: new_spanned ( ty , " " , ) ) } else if ty == " " || ty == " " || ty == " " || ty == " " || ty == " " || ty == " " { Err ( syn :: Error :: new_spanned ( ty , " " , ) ) } else if ty == " " { Ok ( 8 ) } else if ty == " " { Ok ( 16 ) } else if ty == " " { Ok ( 32 ) } else if ty == " " { Ok ( 64 ) } else if ty == " " { Ok ( 128 ) } else { Err ( syn :: Error :: new_spanned ( ty , " " , ) ) } }
Check the repr and return the number of bits available
Check the repr and return the number of bits available
ty
&Ident
ty
&Ident