Fat32Node

Struct Fat32Node 

Source
pub struct Fat32Node {
    pub name: RwLock<String>,
    pub file_type: RwLock<FileType>,
    pub metadata: RwLock<FileMetadata>,
    pub children: RwLock<BTreeMap<String, Arc<dyn VfsNode>>>,
    pub parent: RwLock<Option<Weak<Fat32Node>>>,
    pub filesystem: RwLock<Option<Weak<dyn FileSystemOperations>>>,
    pub cluster: RwLock<u32>,
    pub children_loaded: RwLock<bool>,
}
Expand description

FAT32 filesystem node

This structure represents a file or directory in the FAT32 filesystem. It implements the VfsNode trait to integrate with the VFS v2 architecture. Content is read/written directly from/to the block device, not stored in memory.

Fields§

§name: RwLock<String>

Node name

§file_type: RwLock<FileType>

File type (file or directory)

§metadata: RwLock<FileMetadata>

File metadata

§children: RwLock<BTreeMap<String, Arc<dyn VfsNode>>>

Child nodes (for directories) - cached, but loaded from disk on demand

§parent: RwLock<Option<Weak<Fat32Node>>>

Parent node (weak reference to avoid cycles)

§filesystem: RwLock<Option<Weak<dyn FileSystemOperations>>>

Reference to filesystem

§cluster: RwLock<u32>

Starting cluster number in FAT32

§children_loaded: RwLock<bool>

Directory entries loaded flag (for directories)

Implementations§

Source§

impl Fat32Node

Source

pub fn new_file(name: String, file_id: u64, cluster: u32) -> Self

Create a new regular file node

Source

pub fn new_directory(name: String, file_id: u64, cluster: u32) -> Self

Create a new directory node

Source

pub fn set_parent(&self, parent: Option<Weak<Fat32Node>>)

Set the parent node (weak reference)

Source

pub fn set_filesystem(&self, filesystem: Weak<dyn FileSystemOperations>)

Set the filesystem reference

Source

pub fn cluster(&self) -> u32

Get the starting cluster number

Source

pub fn set_cluster(&self, cluster: u32)

Set the starting cluster number

Trait Implementations§

Source§

impl Clone for Fat32Node

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Fat32Node

Source§

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

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

impl VfsNode for Fat32Node

Source§

fn id(&self) -> u64

Returns the unique identifier in the filesystem
Source§

fn filesystem(&self) -> Option<Weak<dyn FileSystemOperations>>

Returns a (Weak) reference to the filesystem this node belongs to
Source§

fn file_type(&self) -> Result<FileType, FileSystemError>

Get the file type of this node
Source§

fn metadata(&self) -> Result<FileMetadata, FileSystemError>

Get metadata for this node
Source§

fn as_any(&self) -> &dyn Any

Helper for downcasting
Source§

fn is_directory(&self) -> Result<bool, FileSystemError>

Returns true if this node is a directory
Returns true if this node is a symbolic link
Read the target of a symbolic link (returns error if not a symlink)

Auto Trait Implementations§

§

impl !Freeze for Fat32Node

§

impl !RefUnwindSafe for Fat32Node

§

impl Send for Fat32Node

§

impl Sync for Fat32Node

§

impl Unpin for Fat32Node

§

impl !UnwindSafe for Fat32Node

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.