fn find_param_str(name: &str, args: &[NestedMeta]) -> Option<String> {
    args.iter()
        .filter_map(|arg| match arg {
            NestedMeta::Meta(Meta::NameValue(nv)) => Some(nv),
            _ => None,
        })
        .filter_map(|arg| {
            // Match the parameter identifier
            match arg.path.segments.first() {
                Some(segment) if segment.ident == name => {}
                _ => return None,
            }

            // Get the parameter string value
            match &arg.lit {
                Lit::Str(value) => Some(value.value()),
                _ => panic!("parameter {0} must have string value: {0} = \"abc\"", name),
            }
        })
        .next()
}
/// Find a string value for an attribute parameter.
///
/// This function wals through a list of `NestedMeta` parsed from an attributes token stream.
/// It then attempts to find a key/value pair having `name`, and returns a string value.
///
/// If the parameter was not found, or if the value wasn't a string, `None` is returned.
Find a string value for an attribute parameter.
This function wals through a list of `NestedMeta` parsed from an attributes token stream.
It then attempts to find a key/value pair having `name`, and returns a string value.

If the parameter was not found, or if the value wasn't a string, `None` is returned.
Find a string value for an attribute parameter . This function wals through a list of ` NestedMeta ` parsed from an attributes token stream . It then attempts to find a key / value pair having ` name ` and returns a string value . If the parameter was not found or if the value wasn ' t a string ` None ` is returned .
fn find_param_str(name: &str, args: &[NestedMeta]) -> Option<String> {
    args.iter()
        .filter_map(|arg| match arg {
            NestedMeta::Meta(Meta::NameValue(nv)) => Some(nv),
            _ => None,
        })
        .filter_map(|arg| {
            // Match the parameter identifier
            match arg.path.segments.first() {
                Some(segment) if segment.ident == name => {}
                _ => return None,
            }
            // Get the parameter string value
            match &arg.lit {
                Lit::Str(value) => Some(value.value()),
                _ => panic!("parameter {0} must have string value: {0} = \"abc\"", name),
            }
        })
        .next()
}
fn find_param_str ( name : & str , args : & [ NestedMeta ] ) -> Option < String > { args . iter ( ) . filter_map ( | arg | match arg { NestedMeta :: Meta ( Meta :: NameValue ( nv ) ) => Some ( nv ) , _ => None , } ) . filter_map ( | arg | { // Match the parameter identifier match arg . path . segments . first ( ) { Some ( segment ) if segment . ident == name => { } _ => return None , } // Get the parameter string value match & arg . lit { Lit :: Str ( value ) => Some ( value . value ( ) ) , _ => panic ! ( " \" \" " name ) , } } ) . next ( ) }
Find a string value for an attribute parameter.
Find a string value for an attribute parameter .
name
&str
args
&[NestedMeta]