file_storage/path/properties/
len.rs1use crate::{FilePath, FolderPath, StoragePath};
2
3impl StoragePath {
4 pub fn len(&self) -> usize {
8 self.path().len()
9 }
10
11 pub fn is_empty(&self) -> bool {
13 self.len() == 0
14 }
15}
16
17impl FilePath {
18 pub fn len(&self) -> usize {
22 self.path().len()
23 }
24
25 pub fn is_empty(&self) -> bool {
27 self.len() == 0
28 }
29}
30
31impl FolderPath {
32 pub fn len(&self) -> usize {
36 self.path().len()
37 }
38
39 pub fn is_empty(&self) -> bool {
41 self.len() == 0
42 }
43}
44
45#[cfg(test)]
46mod tests {
47 use crate::StoragePath;
48
49 #[test]
50 fn len() {
51 let path: StoragePath = unsafe { StoragePath::new("/你/好", 1, '/') };
52 assert_eq!(path.len(), 8);
53 }
54}