pub fn get_filename(file: &Path) -> Option<&str>Expand description
Extracts the filename component from the given file path and returns it as an Option<&str>.
If the file path contains a filename, this function returns Some(filename) where filename is
the extracted filename as a string slice (&str). If the file path does not have a filename
component or if the filename is not valid UTF-8, it returns None.
§Arguments
file: A reference to aPathrepresenting the file path from which to extract the filename.
§Returns
Some(filename): If a valid filename exists in thefilepath, wherefilenameis the extracted filename as a string slice (&str).None: If thefilepath does not contain a valid filename or if the filename is not valid UTF-8.