pub fn path_to_ident(path: &Path) -> Option<Ident> {
    if path.segments.len() != 1 {
        return None;
    }

    let segment = &path.segments[0];
    if !segment.parameters.is_empty() {
        return None;
    }

    Some(segment.identifier)
}
// If path is a single segment ident path, return that ident. Otherwise, return
// None.
If path is a single segment ident path, return that ident. Otherwise, return
None.
If path is a single segment ident path return that ident . Otherwise return None .
pub fn path_to_ident(path: &Path) -> Option<Ident> {
    if path.segments.len() != 1 {
        return None;
    }
    let segment = &path.segments[0];
    if !segment.parameters.is_empty() {
        return None;
    }
    Some(segment.identifier)
}
pub fn path_to_ident ( path : & Path ) -> Option < Ident > { if path . segments . len ( ) != 1 { return None ; } let segment = & path . segments [ 0 ] ; if ! segment . parameters . is_empty ( ) { return None ; } Some ( segment . identifier ) }
If path is a single segment ident path, return that ident.
If path is a single segment ident path return that ident .
path
&Path
path
&Path