pub struct RepoPath(/* private fields */);Expand description
A repository path as the snapshot names it, mirroring the schema’s
RepoPath union: text when the raw bytes are valid UTF-8, and the bytes
themselves otherwise. Construction classifies, so one logical path has
exactly one representation and a digest can never split across forms.
Implementations§
Source§impl RepoPath
impl RepoPath
Sourcepub fn from_bytes(raw: Vec<u8>) -> Option<Self>
pub fn from_bytes(raw: Vec<u8>) -> Option<Self>
The primary constructor: validates the byte grammar, then holds the path as text exactly when the bytes decode as UTF-8.
pub fn new(raw: String) -> Option<Self>
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_str(&self) -> Option<&str>
Trait Implementations§
Source§impl Borrow<[u8]> for RepoPath
Map queries run on raw bytes, because a range boundary such as path/
is not itself a valid path. Sound: ordering and equality are the byte
forms already.
impl Borrow<[u8]> for RepoPath
Map queries run on raw bytes, because a range boundary such as path/
is not itself a valid path. Sound: ordering and equality are the byte
forms already.
impl Eq for RepoPath
Source§impl From<&RepoPathText> for RepoPath
Text-form paths embed without revalidation: both types enforce the one
byte grammar, and a String is UTF-8 by construction.
impl From<&RepoPathText> for RepoPath
Text-form paths embed without revalidation: both types enforce the one
byte grammar, and a String is UTF-8 by construction.
Source§fn from(text: &RepoPathText) -> Self
fn from(text: &RepoPathText) -> Self
Converts to this type from the input type.
Source§impl Ord for RepoPath
impl Ord for RepoPath
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
Auto Trait Implementations§
impl Freeze for RepoPath
impl RefUnwindSafe for RepoPath
impl Send for RepoPath
impl Sync for RepoPath
impl Unpin for RepoPath
impl UnsafeUnpin for RepoPath
impl UnwindSafe for RepoPath
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