Struct NtfsFileName

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

Structure of a $FILE_NAME attribute.

NTFS creates a $FILE_NAME attribute for every hard link. Its valuable information is the actual file name and whether this file represents a directory. Apart from that, it duplicates several fields of $STANDARD_INFORMATION, but these are only updated when the file name changes. You usually want to use the corresponding fields from NtfsStandardInformation instead.

A $FILE_NAME attribute can be resident or non-resident.

Reference: https://flatcap.github.io/linux-ntfs/ntfs/attributes/file_name.html

Implementations§

Source§

impl NtfsFileName

Source

pub fn access_time(&self) -> NtfsTime

Returns the last access time stored in this $FILE_NAME record.

Note that NTFS only updates it when the file name is changed! Check NtfsStandardInformation::access_time for a last access time that is always up to date.

Source

pub fn allocated_size(&self) -> u64

Returns the allocated size of the file data, in bytes. “Data” refers to the unnamed $DATA attribute only. Other $DATA attributes are not considered.

Note that NTFS only updates it when the file name is changed! If you need an always up-to-date allocated size, use NtfsFile::data to get the unnamed $DATA attribute, fetch the corresponding NtfsAttribute, and use NtfsAttribute::value to fetch the corresponding NtfsAttributeValue. For non-resident attribute values, you now need to walk through each Data Run and sum up the return values of NtfsDataRun::allocated_size. For resident attribute values, the length equals the allocated size.

Source

pub fn creation_time(&self) -> NtfsTime

Returns the creation time stored in this $FILE_NAME record.

Note that NTFS only updates it when the file name is changed! Check NtfsStandardInformation::creation_time for a creation time that is always up to date.

Source

pub fn data_size(&self) -> u64

Returns the size actually used by the file data, in bytes.

“Data” refers to the unnamed $DATA attribute only. Other $DATA attributes are not considered.

This is less or equal than NtfsFileName::allocated_size.

Note that NTFS only updates it when the file name is changed! If you need an always up-to-date size, use NtfsFile::data to get the unnamed $DATA attribute, fetch the corresponding NtfsAttribute, and use NtfsAttribute::value to fetch the corresponding NtfsAttributeValue. Then query NtfsAttributeValue::len.

Source

pub fn file_attributes(&self) -> NtfsFileAttributeFlags

Returns flags that a user can set for a file (Read-Only, Hidden, System, Archive, etc.). Commonly called “File Attributes” in Windows Explorer.

Note that NTFS only updates it when the file name is changed! Check NtfsStandardInformation::file_attributes for file attributes that are always up to date.

Source

pub fn is_directory(&self) -> bool

Returns whether this file is a directory.

Source

pub fn mft_record_modification_time(&self) -> NtfsTime

Returns the MFT record modification time stored in this $FILE_NAME record.

Note that NTFS only updates it when the file name is changed! Check NtfsStandardInformation::mft_record_modification_time for an MFT record modification time that is always up to date.

Source

pub fn modification_time(&self) -> NtfsTime

Returns the modification time stored in this $FILE_NAME record.

Note that NTFS only updates it when the file name is changed! Check NtfsStandardInformation::modification_time for a modification time that is always up to date.

Source

pub fn name(&self) -> U16StrLe<'_>

Gets the file name and returns it wrapped in a U16StrLe.

Source

pub fn name_length(&self) -> usize

Returns the file name length, in bytes.

A file name has a maximum length of 255 UTF-16 code points (510 bytes).

Source

pub fn namespace(&self) -> NtfsFileNamespace

Returns the NtfsFileNamespace of this file name.

Source

pub fn parent_directory_reference(&self) -> NtfsFileReference

Returns an NtfsFileReference for the directory where this file is located.

Trait Implementations§

Source§

impl Clone for NtfsFileName

Source§

fn clone(&self) -> NtfsFileName

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NtfsFileName

Source§

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

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

impl NtfsIndexEntryKey for NtfsFileName

Source§

fn key_from_slice(slice: &[u8], position: NtfsPosition) -> Result<Self>

Source§

impl<'n, 'f> NtfsStructuredValue<'n, 'f> for NtfsFileName

Source§

const TY: NtfsAttributeType = NtfsAttributeType::FileName

Source§

fn from_attribute_value<T>( fs: &mut T, value: NtfsAttributeValue<'n, 'f>, ) -> Result<Self>
where T: Read + Seek,

Create a structured value from an arbitrary NtfsAttributeValue.

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<T> CloneToUninit for T
where T: Clone,

Source§

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
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

Uses borrowed data to replace owned data, usually by cloning. Read more
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.