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

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

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.

This example is not tested
use libpijul::path::parent;
assert_eq!(parent("/foo/bar"), Some("/foo"));
assert_eq!(parent("foo"), Some(""));
assert_eq!(parent("/"), None);
assert_eq!(parent(""), None);