Struct ntfs::Ntfs

source ·
pub struct Ntfs { /* private fields */ }
Expand description

Root structure describing an NTFS filesystem.

Implementations§

source§

impl Ntfs

source

pub fn new<T>(fs: &mut T) -> Result<Self>where T: Read + Seek,

Creates a new Ntfs object from a reader and validates its boot sector information.

The reader must cover the entire NTFS partition, not more and not less. It will be rewinded to the beginning before reading anything.

source

pub fn cluster_size(&self) -> u32

Returns the size of a single cluster, in bytes.

source

pub fn file<'n, T>( &'n self, fs: &mut T, file_record_number: u64 ) -> Result<NtfsFile<'n>>where T: Read + Seek,

Returns the NtfsFile for the given NTFS File Record Number.

The first few NTFS files have fixed indexes and contain filesystem management information (see the KnownNtfsFileRecordNumber enum).

source

pub fn file_record_size(&self) -> u32

Returns the size of a File Record of this NTFS filesystem, in bytes.

source

pub fn mft_position(&self) -> NtfsPosition

Returns the absolute byte position of the Master File Table (MFT).

This NtfsPosition is guaranteed to be nonzero.

source

pub fn read_upcase_table<T>(&mut self, fs: &mut T) -> Result<()>where T: Read + Seek,

Reads the $UpCase file from the filesystem and stores it in this Ntfs object.

This function only needs to be called if case-insensitive comparisons are later performed (i.e. finding files).

source

pub fn root_directory<'n, T>(&'n self, fs: &mut T) -> Result<NtfsFile<'n>>where T: Read + Seek,

Returns the root directory of this NTFS volume as an NtfsFile.

source

pub fn sector_size(&self) -> u16

Returns the size of a single sector in bytes.

source

pub fn serial_number(&self) -> u64

Returns the 64-bit serial number of this NTFS volume.

source

pub fn size(&self) -> u64

Returns the partition size in bytes.

source

pub fn volume_info<T>(&self, fs: &mut T) -> Result<NtfsVolumeInformation>where T: Read + Seek,

Returns an NtfsVolumeInformation containing general information about the volume, like the NTFS version.

source

pub fn volume_name<T>(&self, fs: &mut T) -> Option<Result<NtfsVolumeName>>where T: Read + Seek,

Returns an NtfsVolumeName to read the volume name (also called volume label) of this NTFS volume.

Note that a volume may also have no label, which is why the return value is further encapsulated in an Option.

Trait Implementations§

source§

impl Debug for Ntfs

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Ntfs

§

impl Send for Ntfs

§

impl Sync for Ntfs

§

impl Unpin for Ntfs

§

impl UnwindSafe for Ntfs

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, 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.