pub struct ContainerPath(/* private fields */);Expand description
A manifest container path: relative to the owner’s pod root, naming a container.
The path rule: no leading /, exactly one terminal /, no empty inner
segment, no . or .. segment and no %; it is case-sensitive and
never decoded. It is checked by prefixing /pods/<owner>/ and applying
PodPath::parse to the result, which must be a container and not an
ACL. Its first segment may not be profile.
§Examples
use stratum_node_core::{ContainerPath, DidNostr};
let path: ContainerPath = "reports/2026/".parse()?;
let owner = DidNostr::from_hex("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")?;
assert_eq!(path.under(&owner).as_str(), format!("/pods/{}/reports/2026/", owner.to_hex()));
for bad in ["", "/reports/", "reports", "reports//", "a/../b/", "a%2F/", "profile/", "Reports Ö/"] {
assert!(bad.parse::<ContainerPath>().is_err(), "{bad}");
}
assert!("profiles/".parse::<ContainerPath>().is_ok());Implementations§
Source§impl ContainerPath
impl ContainerPath
Sourcepub fn parse(text: &str) -> Result<Self, ContainerPathError>
pub fn parse(text: &str) -> Result<Self, ContainerPathError>
Checks text against the path rule.
§Errors
Returns the first rule the text breaks, as a ContainerPathError.
Trait Implementations§
Source§impl AsRef<str> for ContainerPath
impl AsRef<str> for ContainerPath
Source§impl Clone for ContainerPath
impl Clone for ContainerPath
Source§impl Debug for ContainerPath
impl Debug for ContainerPath
Source§impl<'de> Deserialize<'de> for ContainerPath
impl<'de> Deserialize<'de> for ContainerPath
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ContainerPath
impl Display for ContainerPath
impl Eq for ContainerPath
Source§impl FromStr for ContainerPath
impl FromStr for ContainerPath
Source§impl Hash for ContainerPath
impl Hash for ContainerPath
Source§impl Ord for ContainerPath
impl Ord for ContainerPath
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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ContainerPath
impl PartialEq for ContainerPath
Source§impl PartialOrd for ContainerPath
impl PartialOrd for ContainerPath
Source§impl Serialize for ContainerPath
impl Serialize for ContainerPath
impl StructuralPartialEq for ContainerPath
Auto Trait Implementations§
impl Forget for ContainerPath
impl Freeze for ContainerPath
impl Move for ContainerPath
impl RefUnwindSafe for ContainerPath
impl Send for ContainerPathwhere
RawVecInner: Send,
impl Sync for ContainerPathwhere
RawVecInner: Sync,
impl Unpin for ContainerPath
impl UnsafeUnpin for ContainerPath
impl UnwindSafe for ContainerPathwhere
RawVecInner: UnwindSafe,
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