Skip to main content

CachedFat

Struct CachedFat 

Source
pub struct CachedFat<'a> { /* private fields */ }
Expand description

Cached FAT operations that work with any FAT type.

Implementations§

Source§

impl<'a> CachedFat<'a>

Source

pub fn new(cache: &'a mut FatSectorCache, fat: &Fat) -> Self

Create a new cached FAT wrapper.

Source

pub fn next_cluster<T: Read + Seek>( &mut self, reader: &mut T, cluster: usize, ) -> Result<Option<u32>>

Get the next cluster in a chain using the cache.

Source

pub fn read_chain<T: Read + Seek>( &mut self, reader: &mut T, start_cluster: u32, ) -> Result<Vec<u32>>

Read the entire cluster chain starting from a cluster.

This is efficient because it uses the cache to avoid repeated seeks. On a chain longer than max_cluster clusters (only possible if the FAT is corrupt and contains a loop), returns Error::ClusterLoop rather than silently returning a partial chain.

Source

pub fn flush<T: Write + Seek>(&mut self, writer: &mut T) -> Result<()>

Flush the cache to disk.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for CachedFat<'a>

§

impl<'a> Freeze for CachedFat<'a>

§

impl<'a> RefUnwindSafe for CachedFat<'a>

§

impl<'a> Send for CachedFat<'a>

§

impl<'a> Sync for CachedFat<'a>

§

impl<'a> Unpin for CachedFat<'a>

§

impl<'a> UnsafeUnpin for CachedFat<'a>

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.