Skip to main content

FileEntry

Struct FileEntry 

Source
pub struct FileEntry { /* private fields */ }
Expand description

Metadata for a file or subdirectory entry.

Implementations§

Source§

impl FileEntry

Source

pub fn name(&self) -> Cow<'_, str>

Get the file’s display name.

Returns the long filename if available, otherwise the short name. The Cow is borrowed for short names and owned (allocated) for long names, since long names are stored internally as UTF-16 and require decoding before they can be exposed as a &str.

Requires the alloc feature. Without alloc, use Self::short_name and Self::long_name (with LongFileName::chars / LongFileName::eq_str) directly.

Source

pub fn short_name(&self) -> &ShortFileName

Get the short (8.3) filename, in its canonical on-disk (uppercase) form.

Use Self::nt_case with ShortFileName::with_nt_case to recover the original lowercase presentation without allocating.

Source

pub fn nt_case(&self) -> NtCaseFlags

Windows NT 8.3 name case flags (DIR_NTRes) for this entry.

Records whether the short name’s base and/or extension were originally lowercase. Meaningful only when the entry has no long file name.

Source

pub fn long_name(&self) -> Option<&LongFileName>

Get the long filename, if available

Source

pub fn attributes(&self) -> DirEntryAttrFlags

Get the file attributes

Source

pub fn is_directory(&self) -> bool

Check if this entry is a directory

Source

pub fn is_file(&self) -> bool

Check if this entry is a regular file

Source

pub fn len(&self) -> u64

Returns the file length in bytes (zero for directories).

Source

pub fn is_empty(&self) -> bool

Returns whether this entry has a zero byte length.

Source

pub fn created(&self) -> FatDateTime

Creation timestamp (date + time + 10-ms units).

Source

pub fn accessed_date(&self) -> u16

Last-access date. FAT does not store an access time, only a date. Returns the raw FAT-encoded date (year-1980)<<9 | month<<5 | day.

Source

pub fn modified(&self) -> FatDateTime

Last-modified timestamp (date + time; sub-2-second precision is not preserved by FAT for the modified field).

Source

pub fn cluster(&self) -> Cluster<usize>

Get the first cluster of the file data

Trait Implementations§

Source§

impl Debug for FileEntry

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> MaybePod for T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.