Struct tvix_castore::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

source

pub const ROOT: &'static Path = _

source

const unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Path

Convert a byte slice to a path, without checking validity.

source

fn from_bytes(bytes: &[u8]) -> Option<&Path>

source

pub fn into_boxed_bytes(self: Box<Path>) -> Box<[u8]>

source

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.

source

pub fn try_join(&self, name: &[u8]) -> Result<PathBuf, Error>

Creates a PathBuf with name adjoined to self.

source

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.

source

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.

source

pub fn file_name(&self) -> Option<PathComponent>

Returns the final component of the Path, if there is one, in bytes.

source

pub fn file_name_bytes(&self) -> Option<&[u8]>

Returns the final component of the Path, if there is one, in bytes.

source

pub fn as_bytes(&self) -> &[u8]

Trait Implementations§

source§

impl AsRef<Path> for Path

source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Path> for PathBuf

source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<Path> for PathBuf

source§

fn borrow(&self) -> &Path

Immutably borrows from an owned value. Read more
source§

impl Debug for Path

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Path

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&Path> for PathBuf

source§

fn from(value: &Path) -> Self

Converts to this type from the input type.
source§

impl Hash for Path

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
source§

impl PartialEq for Path

source§

fn eq(&self, other: &Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToOwned for Path

source§

type Owned = PathBuf

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Eq for Path

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more