jotta_fs/
path.rs

1//! Jottacloud paths.
2use std::ops::Deref;
3
4use derive_more::Display;
5use serde::{Deserialize, Serialize};
6
7/// Path to a file or folder in Jottacloud, without specifying
8/// on what device.
9///
10/// `<mount point>/...`
11#[derive(Debug, Serialize, Deserialize, Display)]
12#[allow(clippy::module_name_repetitions)]
13pub struct PathOnDevice(pub String);
14
15/// A path without the user part:
16///
17/// `<device>/...`
18#[derive(Debug, Serialize, Deserialize, Display)]
19#[allow(clippy::module_name_repetitions)]
20pub struct UserScopedPath(pub String);
21
22impl Deref for UserScopedPath {
23    type Target = str;
24
25    fn deref(&self) -> &Self::Target {
26        &self.0
27    }
28}
29
30/// An absolute path:
31///
32/// `<user>/<device>/...`
33#[derive(Debug, Serialize, Deserialize, Display)]
34#[allow(clippy::module_name_repetitions)]
35pub struct AbsolutePath(pub String);