file_storage/path/properties/
is_file.rs1use crate::StoragePath;
2
3impl StoragePath {
4 pub fn is_file(&self) -> bool {
8 !self.is_folder()
9 }
10}
11
12#[cfg(test)]
13mod tests {
14 use crate::StoragePath;
15
16 #[test]
17 fn is_file_or_folder() {
18 let path: StoragePath = unsafe { StoragePath::new("/the/path", 1, '/') };
19 assert!(path.is_file());
20
21 let path: StoragePath = unsafe { StoragePath::new("/the/path/", 1, '/') };
22 assert!(!path.is_file());
23
24 let path: StoragePath = unsafe { StoragePath::new("!", 1, '/') };
25 assert!(!path.is_file());
26 }
27}