pub struct StoragePath(/* private fields */);Expand description
A canonical decoded Pubky storage path that can be encoded as an HTTP/WebDAV URI path.
Percent signs are literal. URL decoding must happen before construction. Paths cannot end in whitespace because storage backends may trim it.
Implementations§
Source§impl StoragePath
impl StoragePath
Sourcepub fn new(path: &str) -> Result<Self, StoragePathError>
pub fn new(path: &str) -> Result<Self, StoragePathError>
Parse an already-canonical decoded absolute path.
Sourcepub fn normalize(path: &str) -> Result<Self, StoragePathError>
pub fn normalize(path: &str) -> Result<Self, StoragePathError>
Normalize a decoded absolute HTTP/WebDAV path and validate the result.
Sourcepub fn is_directory(&self) -> bool
pub fn is_directory(&self) -> bool
Return whether this path is directory-shaped.
Sourcepub fn url_encode(&self) -> String
pub fn url_encode(&self) -> String
Encode this decoded path for use as an HTTP URL path.
Trait Implementations§
Source§impl AsRef<str> for StoragePath
impl AsRef<str> for StoragePath
Source§impl Clone for StoragePath
impl Clone for StoragePath
Source§fn clone(&self) -> StoragePath
fn clone(&self) -> StoragePath
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StoragePath
impl Debug for StoragePath
Source§impl<'de> Deserialize<'de> for StoragePath
impl<'de> Deserialize<'de> for StoragePath
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for StoragePath
impl Display for StoragePath
impl Eq for StoragePath
Source§impl FromStr for StoragePath
impl FromStr for StoragePath
Source§impl Hash for StoragePath
impl Hash for StoragePath
Source§impl Ord for StoragePath
impl Ord for StoragePath
Source§fn cmp(&self, other: &StoragePath) -> Ordering
fn cmp(&self, other: &StoragePath) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for StoragePath
impl PartialEq for StoragePath
Source§impl PartialOrd for StoragePath
impl PartialOrd for StoragePath
Source§impl Serialize for StoragePath
impl Serialize for StoragePath
impl StructuralPartialEq for StoragePath
Source§impl TryFrom<&str> for StoragePath
impl TryFrom<&str> for StoragePath
Auto Trait Implementations§
impl Freeze for StoragePath
impl RefUnwindSafe for StoragePath
impl Send for StoragePath
impl Sync for StoragePath
impl Unpin for StoragePath
impl UnsafeUnpin for StoragePath
impl UnwindSafe for StoragePath
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more