fn depot_number(name: &str) -> Option<u16> {
    let len = name.len();
    if name.starts_with("d") && len > 1 {
        name[1..].parse().ok().and_then(|n| {
            // @FIXME use Option#filter when in stable
            if n <= MAX_COMPONENT_VALUE {
                Some(n)
            } else {
                None
            }
        })
    } else {
        None
    }
}
/// Extracts the number from a depot directory/file name.
Extracts the number from a depot directory/file name.
Extracts the number from a depot directory / file name .
fn depot_number(name: &str) -> Option<u16> {
    let len = name.len();
    if name.starts_with("d") && len > 1 {
        name[1..].parse().ok().and_then(|n| {
            // @FIXME use Option#filter when in stable
            if n <= MAX_COMPONENT_VALUE {
                Some(n)
            } else {
                None
            }
        })
    } else {
        None
    }
}
fn depot_number ( name : & str ) -> Option < u16 > { let len = name . len ( ) ; if name . starts_with ( " " ) && len > 1 { name [ 1 .. ] . parse ( ) . ok ( ) . and_then ( | n | { // @FIXME use Option#filter when in stable if n <= MAX_COMPONENT_VALUE { Some ( n ) } else { None } } ) } else { None } }
Extracts the number from a depot directory/file name.
Extracts the number from a depot directory / file name .
name
&str
name
&str