pub struct VfsEntry {
parent: RwLock<Weak<VfsEntry>>,
name: String,
node: Arc<dyn VfsNode>,
children: RwLock<BTreeMap<String, Weak<VfsEntry>>>,
}
Expand description
VfsEntry represents a node in the VFS path hierarchy (similar to Linux dentry)
This structure represents the VFS’s in-memory filesystem hierarchy graph. It serves as:
- A “name” representation within a directory
- A “link” that constructs parent-child relationships in the VFS graph
- A cache for fast re-access to already resolved paths
VfsEntry is designed to be thread-safe and can be shared across threads.
Fields§
§parent: RwLock<Weak<VfsEntry>>
Weak reference to parent VfsEntry (prevents circular references)
name: String
Name of this VfsEntry (e.g., “user”, “file.txt”)
node: Arc<dyn VfsNode>
Reference to the corresponding file entity (VfsNode)
children: RwLock<BTreeMap<String, Weak<VfsEntry>>>
Cache of child VfsEntries for fast lookup (using Weak to prevent memory leaks)
Implementations§
Source§impl VfsEntry
impl VfsEntry
Sourcepub fn new(
parent: Option<Weak<VfsEntry>>,
name: String,
node: Arc<dyn VfsNode>,
) -> Arc<Self>
pub fn new( parent: Option<Weak<VfsEntry>>, name: String, node: Arc<dyn VfsNode>, ) -> Arc<Self>
Create a new VfsEntry
pub fn set_parent(&self, parent: Weak<VfsEntry>)
Sourcepub fn add_child(self: &Arc<Self>, name: String, child: Arc<VfsEntry>)
pub fn add_child(self: &Arc<Self>, name: String, child: Arc<VfsEntry>)
Add a child to the cache
Sourcepub fn remove_child(&self, name: &String) -> Option<Arc<VfsEntry>>
pub fn remove_child(&self, name: &String) -> Option<Arc<VfsEntry>>
Remove a child from the cache
Sourcepub fn cleanup_cache(&self)
pub fn cleanup_cache(&self)
Clean up expired weak references in the cache
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for VfsEntry
impl !RefUnwindSafe for VfsEntry
impl Send for VfsEntry
impl Sync for VfsEntry
impl Unpin for VfsEntry
impl !UnwindSafe for VfsEntry
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)