Struct tvix_castore::path::Path
source · #[repr(transparent)]pub struct Path {
inner: [u8],
}
Expand description
Represents a Path in the castore model. These are always relative, and platform-independent, which distinguishes them from the ones provided in the standard library.
Fields§
§inner: [u8]
Implementations§
source§impl Path
impl Path
pub const ROOT: &'static Path = _
sourceconst unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Path
const unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Path
Convert a byte slice to a path, without checking validity.
fn from_bytes(bytes: &[u8]) -> Option<&Path>
pub fn into_boxed_bytes(self: Box<Path>) -> Box<[u8]>
sourcepub fn parent(&self) -> Option<&Path>
pub fn parent(&self) -> Option<&Path>
Returns the path without its final component, if there is one.
Note that the parent of a bare file name is Path::ROOT. Path::ROOT is the only path without a parent.
sourcepub fn try_join(&self, name: &[u8]) -> Result<PathBuf, Error>
pub fn try_join(&self, name: &[u8]) -> Result<PathBuf, Error>
Creates a PathBuf with name
adjoined to self.
sourcepub fn components(&self) -> impl Iterator<Item = PathComponent> + '_
pub fn components(&self) -> impl Iterator<Item = PathComponent> + '_
Provides an iterator over the components of the path, which are invividual PathComponent. In case the path is empty, an empty iterator is returned.
sourcepub fn components_bytes(&self) -> impl Iterator<Item = &[u8]>
pub fn components_bytes(&self) -> impl Iterator<Item = &[u8]>
Produces an iterator over the components of the path, which are individual byte slices. In case the path is empty, an empty iterator is returned.
sourcepub fn file_name(&self) -> Option<PathComponent>
pub fn file_name(&self) -> Option<PathComponent>
Returns the final component of the Path, if there is one, in bytes.
sourcepub fn file_name_bytes(&self) -> Option<&[u8]>
pub fn file_name_bytes(&self) -> Option<&[u8]>
Returns the final component of the Path, if there is one, in bytes.
pub fn as_bytes(&self) -> &[u8] ⓘ
Trait Implementations§
source§impl PartialEq for Path
impl PartialEq for Path
source§impl ToOwned for Path
impl ToOwned for Path
impl Eq for Path
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl !Sized for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.