file_storage/path/properties/base_path.rs
1use crate::StoragePath;
2
3impl StoragePath {
4 //! Base Path
5
6 /// Gets the base path.
7 pub fn base_path(&self) -> &str {
8 &self.path()[..self.base_len()]
9 }
10}
11
12#[cfg(test)]
13mod tests {
14 use crate::StoragePath;
15
16 #[test]
17 fn base() {
18 let path: StoragePath = unsafe { StoragePath::new("/the/path", 1, '/') };
19 assert_eq!(path.base_path(), "/");
20 }
21}