pub enum FileNode<T> {
Regular {
size: u64,
executable: bool,
},
Symlink {
target: ByteBuf,
},
Directory {
size: u64,
contents: T,
},
}
Expand description
This enum represents a single node in a file tree.
The type is generic over the contents of a directory node, because we want to use this enum to represent both a flat structure where a directory only stores some meta-information about itself (such as the number of children) and full file trees, where a directory contains all the child nodes.
Note that file nodes by themselves do not have names. Names are given to file nodes by the parent directory, which has a map of entry names to file nodes.
Variants§
Regular
A regular file. This is the normal kind of file which is neither a directory not a symlink.
Fields
Symlink
A symbolic link that points to another file path.
Directory
A directory. It usually has a mapping of names to child nodes (in the case of a fill tree), but we also support a reduced form where we only store the number of entries in the directory.
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for FileNode<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for FileNode<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<T> StructuralPartialEq for FileNode<T>
Auto Trait Implementations§
impl<T> Freeze for FileNode<T>where
T: Freeze,
impl<T> RefUnwindSafe for FileNode<T>where
T: RefUnwindSafe,
impl<T> Send for FileNode<T>where
T: Send,
impl<T> Sync for FileNode<T>where
T: Sync,
impl<T> Unpin for FileNode<T>where
T: Unpin,
impl<T> UnwindSafe for FileNode<T>where
T: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more