file-storage 0.8.0

This library aids in accessing file-like storage.
Documentation
use crate::StoragePath;

impl StoragePath {
    //! Is Unix

    /// Checks if the path is a Unix path.
    pub fn is_unix_path(&self) -> bool {
        Self::is_unix_path_str(self.path())
    }

    /// Checks if the `path` is a Unix path.
    pub fn is_unix_path_str<S>(path: S) -> bool
    where
        S: AsRef<str>,
    {
        path.as_ref().starts_with('/')
    }
}

#[cfg(test)]
mod tests {
    use crate::StoragePath;

    #[test]
    fn is_unix_path_str() {
        assert!(StoragePath::is_unix_path_str("/"));
        assert!(StoragePath::is_unix_path_str("/usr/bin"));
        assert!(StoragePath::is_unix_path_str("/file.txt"));

        assert!(!StoragePath::is_unix_path_str("C:\\"));
        assert!(!StoragePath::is_unix_path_str("relative"));
        assert!(!StoragePath::is_unix_path_str(""));
    }
}