file_storage/path/core/
clone.rs1use crate::{FilePath, FolderPath, StoragePath};
2
3impl StoragePath {
4 pub fn clone_with_extra_capacity(&self, extra_capacity: usize) -> Self {
8 let mut path: String = String::with_capacity(self.len() + extra_capacity);
9 path.push_str(self.path());
10 unsafe { Self::new(path, self.base_len(), self.file_separator()) }
11 }
12}
13
14impl FilePath {
15 pub fn clone_with_extra_capacity(&self, extra_capacity: usize) -> Self {
19 self.path()
20 .clone_with_extra_capacity(extra_capacity)
21 .to_file()
22 .unwrap()
23 }
24}
25
26impl FolderPath {
27 pub fn clone_with_extra_capacity(&self, extra_capacity: usize) -> Self {
31 self.path()
32 .clone_with_extra_capacity(extra_capacity)
33 .to_folder()
34 .unwrap()
35 }
36}