pub struct Tree {
pub node: TreeNode,
pub children: Vec<Tree>,
/* private fields */
}Expand description
An in-memory tree structure to maintain information and topology of filesystem nodes.
Fields§
§node: TreeNodeFilesystem node.
children: Vec<Tree>Children tree nodes.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn from_bootstrap<T: ChunkDict>(
rs: &RafsSuper,
chunk_dict: &mut T,
) -> Result<Self>
pub fn from_bootstrap<T: ChunkDict>( rs: &RafsSuper, chunk_dict: &mut T, ) -> Result<Self>
Load a Tree from a bootstrap file, and optionally caches chunk information.
Sourcepub fn borrow_mut_node(&self) -> RefMut<'_, Node>
pub fn borrow_mut_node(&self) -> RefMut<'_, Node>
Get mutably borrowed value to access the associated Node object.
Sourcepub fn walk_dfs<F1, F2>(&self, pre: &mut F1, post: &mut F2) -> Result<()>
pub fn walk_dfs<F1, F2>(&self, pre: &mut F1, post: &mut F2) -> Result<()>
Walk all nodes in DFS mode.
Sourcepub fn walk_dfs_pre<F>(&self, cb: &mut F) -> Result<()>
pub fn walk_dfs_pre<F>(&self, cb: &mut F) -> Result<()>
Walk all nodes in pre DFS mode.
Sourcepub fn walk_dfs_post<F>(&self, cb: &mut F) -> Result<()>
pub fn walk_dfs_post<F>(&self, cb: &mut F) -> Result<()>
Walk all nodes in post DFS mode.
Sourcepub fn walk_bfs<F>(&self, handle_self: bool, cb: &mut F) -> Result<()>
pub fn walk_bfs<F>(&self, handle_self: bool, cb: &mut F) -> Result<()>
Walk the tree in BFS mode.
Sourcepub fn insert_child(&mut self, child: Tree)
pub fn insert_child(&mut self, child: Tree)
Insert a new child node into the tree.
Sourcepub fn get_child_idx(&self, name: &[u8]) -> Option<usize>
pub fn get_child_idx(&self, name: &[u8]) -> Option<usize>
Get index of child node with specified name.
Sourcepub fn get_node(&self, path: &Path) -> Option<&Tree>
pub fn get_node(&self, path: &Path) -> Option<&Tree>
Get the tree node corresponding to the path.
Sourcepub fn get_node_mut(&mut self, path: &Path) -> Option<&mut Tree>
pub fn get_node_mut(&mut self, path: &Path) -> Option<&mut Tree>
Get the mutable tree node corresponding to the path.
Sourcepub fn merge_overaly(&mut self, ctx: &BuildContext, upper: Tree) -> Result<()>
pub fn merge_overaly(&mut self, ctx: &BuildContext, upper: Tree) -> Result<()>
Merge the upper layer tree into the lower layer tree, applying whiteout rules.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tree
impl !RefUnwindSafe for Tree
impl !Send for Tree
impl !Sync for Tree
impl Unpin for Tree
impl !UnwindSafe for Tree
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