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 let path: StoragePath = self.path().clone_with_extra_capacity(extra_capacity);
20 unsafe { Self::new(path) }
22 }
23}
24
25impl FolderPath {
26 pub fn clone_with_extra_capacity(&self, extra_capacity: usize) -> Self {
30 let path: StoragePath = self.path().clone_with_extra_capacity(extra_capacity);
31 unsafe { Self::new(path) }
33 }
34}