Function libpijul::path::parent[][src]

pub fn parent(path: &str) -> Option<&str>
Expand description

Returns the parent of the path, if it exists. This function tries to replicate the behaviour of std::path::Path::parent, but with &str instead of Path.

use libpijul::path::parent;
assert_eq!(parent("/foo/bar"), Some("/foo"));
assert_eq!(parent("foo"), Some(""));
assert_eq!(parent("/"), None);
assert_eq!(parent(""), None);