Fat32DirectoryEntry

Struct Fat32DirectoryEntry 

Source
#[repr(C, packed(1))]
pub struct Fat32DirectoryEntry { pub name: [u8; 11], pub attributes: u8, pub nt_reserved: u8, pub creation_time_tenths: u8, pub creation_time: u16, pub creation_date: u16, pub last_access_date: u16, pub cluster_high: u16, pub modification_time: u16, pub modification_date: u16, pub cluster_low: u16, pub file_size: u32, }
Expand description

FAT32 Directory Entry structure

This structure represents a single directory entry in a FAT32 directory. Each entry is exactly 32 bytes.

Fields§

§name: [u8; 11]

Filename (8.3 format, padded with spaces)

§attributes: u8

File attributes

§nt_reserved: u8

Reserved for Windows NT

§creation_time_tenths: u8

Creation time (tenths of a second)

§creation_time: u16

Creation time

§creation_date: u16

Creation date

§last_access_date: u16

Last access date

§cluster_high: u16

High 16 bits of cluster number

§modification_time: u16

Last modification time

§modification_date: u16

Last modification date

§cluster_low: u16

Low 16 bits of cluster number

§file_size: u32

File size in bytes

Implementations§

Source§

impl Fat32DirectoryEntry

Source

pub fn is_free(&self) -> bool

Check if this entry is free (available for use)

Source

pub fn is_last(&self) -> bool

Check if this is the last entry in the directory

Source

pub fn is_long_filename(&self) -> bool

Check if this is a long filename entry

Source

pub fn cluster(&self) -> u32

Get the starting cluster number

Source

pub fn set_cluster(&mut self, cluster: u32)

Set the starting cluster number

Source

pub fn update_cluster_and_size(&mut self, cluster: u32, size: u32)

Update only the cluster and file size fields (preserves SFN and other metadata)

Source

pub fn is_directory(&self) -> bool

Check if this is a directory

Source

pub fn is_file(&self) -> bool

Check if this is a regular file

Source

pub fn is_volume_label(&self) -> bool

Check if this is a volume label

Source

pub fn filename(&self) -> String

Get the filename as a string (8.3 format)

Source

fn parse_filename(name: &[u8; 11]) -> String

Parse 8.3 filename format

Source

pub fn new_file(name: &str, cluster: u32, size: u32) -> Self

Create a new directory entry

Source

pub fn new_directory(name: &str, cluster: u32) -> Self

Create a new directory entry for a directory

Source

fn set_name(&mut self, name: [u8; 11])

Set the filename (8.3 format) - expects properly formatted SFN bytes

Source

pub fn generate_sfn(name: &str, numeric_tail: u32) -> [u8; 11]

Generate proper 8.3 Short File Name (SFN) from a long filename

Source

fn is_valid_sfn_char(c: u8) -> bool

Check if a character is valid for SFN

Trait Implementations§

Source§

impl Clone for Fat32DirectoryEntry

Source§

fn clone(&self) -> Fat32DirectoryEntry

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 Fat32DirectoryEntry

Source§

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

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

impl Copy for Fat32DirectoryEntry

Auto Trait Implementations§

§

impl Freeze for Fat32DirectoryEntry

§

impl RefUnwindSafe for Fat32DirectoryEntry

§

impl Send for Fat32DirectoryEntry

§

impl Sync for Fat32DirectoryEntry

§

impl Unpin for Fat32DirectoryEntry

§

impl UnwindSafe for Fat32DirectoryEntry

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.