fn cut_last_component(mut input: &str) -> &str {
    // Skip any number of trailing '/'es.
    input = match input.rfind(|c| c != '/') {
        Some(i) => &input[0..=i],
        None => input,
    };
    // And now skip the very last chunk of non-'/'es.
    match input.rfind(|c| c == '/') {
        Some(i) => &input[0..=i],
        None => "",
    }
}
/// Removes the last component from a file path given as a string.  `Path` has a
/// similar functionality but it normalizes the input first, which we do not
/// want.  See the usage location.
Removes the last component from a file path given as a string.  `Path` has a
similar functionality but it normalizes the input first, which we do not
want.  See the usage location.
Removes the last component from a file path given as a string . ` Path ` has a similar functionality but it normalizes the input first which we do not want . See the usage location .
fn cut_last_component(mut input: &str) -> &str {
    // Skip any number of trailing '/'es.
    input = match input.rfind(|c| c != '/') {
        Some(i) => &input[0..=i],
        None => input,
    };
    // And now skip the very last chunk of non-'/'es.
    match input.rfind(|c| c == '/') {
        Some(i) => &input[0..=i],
        None => "",
    }
}
fn cut_last_component ( mut input : & str ) -> & str { // Skip any number of trailing '/'es. input = match input . rfind ( | c | c != '/' ) { Some ( i ) => & input [ 0 ..= i ] , None => input , } ; // And now skip the very last chunk of non-'/'es. match input . rfind ( | c | c == '/' ) { Some ( i ) => & input [ 0 ..= i ] , None => " " , } }
Removes the last component from a file path given as a string.
Removes the last component from a file path given as a string .
input
&str