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 copy of the value. Read more
1.0.0 · source§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.