Struct tvix_castore::Directory
source · pub struct Directory {
nodes: BTreeMap<PathComponent, Node>,
}
Expand description
A Directory contains nodes, which can be Directory, File or Symlink nodes. It attaches names to these nodes, which is the basename in that directory. These names:
- MUST not contain slashes or null bytes
- MUST not be ‘.’ or ‘..’
- MUST be unique across all three lists
Fields§
§nodes: BTreeMap<PathComponent, Node>
Implementations§
source§impl Directory
impl Directory
sourcepub fn try_from_iter<T: IntoIterator<Item = (PathComponent, Node)>>(
iter: T,
) -> Result<Directory, DirectoryError>
pub fn try_from_iter<T: IntoIterator<Item = (PathComponent, Node)>>( iter: T, ) -> Result<Directory, DirectoryError>
sourcepub fn size(&self) -> u64
pub fn size(&self) -> u64
The size of a directory is the number of all regular and symlink elements, the number of directory elements, and their size fields.
sourcepub fn digest(&self) -> B3Digest
pub fn digest(&self) -> B3Digest
Calculates the digest of a Directory, which is the blake3 hash of a Directory protobuf message, serialized in protobuf canonical form.
sourcepub fn nodes(
&self,
) -> impl Iterator<Item = (&PathComponent, &Node)> + Send + Sync + '_
pub fn nodes( &self, ) -> impl Iterator<Item = (&PathComponent, &Node)> + Send + Sync + '_
Allows iterating over all nodes (directories, files and symlinks) For each, it returns a tuple of its name and node. The elements are sorted by their names.
sourcepub fn into_nodes(
self,
) -> impl Iterator<Item = (PathComponent, Node)> + Send + Sync
pub fn into_nodes( self, ) -> impl Iterator<Item = (PathComponent, Node)> + Send + Sync
Dissolves a Directory into its individual names and nodes. The elements are sorted by their names.
sourcepub fn add(
&mut self,
name: PathComponent,
node: Node,
) -> Result<(), DirectoryError>
pub fn add( &mut self, name: PathComponent, node: Node, ) -> Result<(), DirectoryError>
Trait Implementations§
impl Eq for Directory
impl StructuralPartialEq for Directory
Auto Trait Implementations§
impl Freeze for Directory
impl RefUnwindSafe for Directory
impl Send for Directory
impl Sync for Directory
impl Unpin for Directory
impl UnwindSafe for Directory
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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
Compare self to
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
Compare self to
key
and return true
if they are equal.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request