fn extract_repr(attrs: &[syn::Attribute]) -> Result<Option<Ident>, syn::Error> {
    use syn::{Meta, NestedMeta};
    attrs
        .iter()
        .find_map(|attr| match attr.parse_meta() {
            Err(why) => Some(Err(syn::Error::new_spanned(
                attr,
                format!("Couldn't parse attribute: {}", why),
            ))),
            Ok(Meta::List(ref meta)) if meta.path.is_ident("repr") => {
                meta.nested.iter().find_map(|mi| match mi {
                    NestedMeta::Meta(Meta::Path(path)) => path.get_ident().cloned().map(Ok),
                    _ => None,
                })
            }
            Ok(_) => None,
        })
        .transpose()
}
/// Given a list of attributes, find the `repr`, if any, and return the integer
/// type specified.
Given a list of attributes, find the `repr`, if any, and return the integer
type specified.
Given a list of attributes find the ` repr ` if any and return the integer type specified .
fn extract_repr(attrs: &[syn::Attribute]) -> Result<Option<Ident>, syn::Error> {
    use syn::{Meta, NestedMeta};
    attrs
        .iter()
        .find_map(|attr| match attr.parse_meta() {
            Err(why) => Some(Err(syn::Error::new_spanned(
                attr,
                format!("Couldn't parse attribute: {}", why),
            ))),
            Ok(Meta::List(ref meta)) if meta.path.is_ident("repr") => {
                meta.nested.iter().find_map(|mi| match mi {
                    NestedMeta::Meta(Meta::Path(path)) => path.get_ident().cloned().map(Ok),
                    _ => None,
                })
            }
            Ok(_) => None,
        })
        .transpose()
}
fn extract_repr ( attrs : & [ syn :: Attribute ] ) -> Result < Option < Ident > , syn :: Error > { use syn :: { Meta , NestedMeta } ; attrs . iter ( ) . find_map ( | attr | match attr . parse_meta ( ) { Err ( why ) => Some ( Err ( syn :: Error :: new_spanned ( attr , format ! ( " " why ) , ) ) ) , Ok ( Meta :: List ( ref meta ) ) if meta . path . is_ident ( " " ) => { meta . nested . iter ( ) . find_map ( | mi | match mi { NestedMeta :: Meta ( Meta :: Path ( path ) ) => path . get_ident ( ) . cloned ( ) . map ( Ok ) , _ => None , } ) } Ok ( _ ) => None , } ) . transpose ( ) }
Given a list of attributes, find the `repr`, if any, and return the integer
type specified.
Given a list of attributes find the ` repr ` if any and return the integer type specified .
attrs
&[syn::Attribute]
attrs
&[syn::Attribute]