pub struct DavPath { /* private fields */ }Expand description
Where a resource lives in Nextcloud’s WebDAV tree.
The user name is held separately from the path below it because every
endpoint in this crate needs the same files/{user} prefix and nothing
else may appear between them. Validation happens once, in
DavPath::new, so a later call cannot send a traversal segment or an
already-prefixed path.
Implementations§
Source§impl DavPath
impl DavPath
Sourcepub fn new(
user: impl AsRef<str>,
relative: impl AsRef<str>,
) -> Result<Self, UrlError>
pub fn new( user: impl AsRef<str>, relative: impl AsRef<str>, ) -> Result<Self, UrlError>
The resource at relative below user’s root.
relative is expected to be relative: "" is the root itself,
"Photos/img.jpg" a nested file. Traversal segments, empty segments
and a leading / are rejected with a UrlError.
Sourcepub fn relative(&self) -> &str
pub fn relative(&self) -> &str
Path below the user’s root, without a leading or trailing slash.
Sourcepub fn segments(&self) -> impl Iterator<Item = &str>
pub fn segments(&self) -> impl Iterator<Item = &str>
Segments of the path below the user root, empty for the root itself.
Sourcepub fn join(&self, segment: impl AsRef<str>) -> Result<Self, UrlError>
pub fn join(&self, segment: impl AsRef<str>) -> Result<Self, UrlError>
A child of this path, validated like a fresh path.
Sourcepub fn to_api_path(&self) -> ApiPath
pub fn to_api_path(&self) -> ApiPath
The path as a request target.