file_storage/path/
file_path.rs

1use crate::StoragePath;
2
3/// A file path.
4#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
5pub struct FilePath {
6    path: StoragePath,
7}
8
9impl FilePath {
10    //! Construction
11
12    /// Creates a file path from the `path`.
13    ///
14    /// # Safety
15    /// The `path` must be a valid file path.
16    pub unsafe fn new(path: StoragePath) -> Self {
17        Self { path }
18    }
19}
20
21impl FilePath {
22    //! Storage Path
23
24    /// Gets the storage path.
25    pub fn path(&self) -> &StoragePath {
26        &self.path
27    }
28
29    /// Converts the file path to a storage path.
30    pub fn to_path(self) -> StoragePath {
31        self.path
32    }
33}