Skip to main content

file_storage/system/local/
local_path.rs

1use crate::StoragePath;
2
3/// A local storage path.
4#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
5pub struct LocalPath<'a> {
6    pub(in crate::system::local) path: &'a StoragePath,
7}
8
9impl<'a> LocalPath<'a> {
10    //! Construction
11
12    /// Creates a local path from the storage `path`.
13    ///
14    /// Returns `None` if the `path` is not a local path.
15    pub fn from(path: &'a StoragePath) -> Option<Self> {
16        if path.is_local_path() {
17            Some(Self { path })
18        } else {
19            None
20        }
21    }
22}