file_storage/path/properties/base.rs
1use crate::StoragePath;
2
3impl StoragePath {
4 //! Base
5
6 /// Gets the path base.
7 pub fn base(&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_and_extension() {
18 let path: StoragePath = unsafe { StoragePath::new("/the/path", 1, '/') };
19 assert_eq!(path.base(), "/");
20 }
21}