Skip to main content

Fat32

Struct Fat32 

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

FAT32 allocation-table descriptor.

Implementations§

Source§

impl Fat32

Source

pub fn new(start: usize, size: usize, count: usize, max_cluster: u32) -> Self

Creates a FAT32 table descriptor.

Source

pub fn max_cluster(&self) -> u32

Get the maximum cluster number.

Source

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

Returns the next cluster in a chain, or None at end-of-chain.

Source

pub fn write_clus<T: Read + Write + Seek>( &self, io: &mut T, cluster: usize, value: u32, ) -> Result<()>

Write a cluster entry to all FAT table copies

Source

pub fn allocate_cluster<T: Read + Write + Seek>( &self, rw: &mut T, hint: u32, ) -> Result<u32>

Allocate a single cluster, returns the allocated cluster number. Searches starting from hint for a free cluster.

Source

pub fn allocate_chain<T: Read + Write + Seek>( &self, rw: &mut T, count: usize, hint: u32, ) -> Result<u32>

Allocate a chain of clusters, linking them together. Returns the first cluster of the allocated chain.

Source

pub fn free_chain<T: Read + Write + Seek>( &self, rw: &mut T, start: u32, ) -> Result<u32>

Free a cluster chain starting at start, returns count of freed clusters.

Source

pub fn truncate_chain<T: Read + Write + Seek>( &self, rw: &mut T, cluster: u32, ) -> Result<u32>

Truncate a cluster chain after the specified cluster.

The specified cluster becomes the end of chain (marked with end-of-chain marker). All clusters following it are freed.

Returns the number of clusters freed.

Source

pub fn mark_bad<T: Read + Write + Seek>( &self, rw: &mut T, cluster: u32, ) -> Result<()>

Mark a cluster as bad (0x0FFFFFF7) in all FAT copies.

Source

pub fn extend_chain<T: Read + Write + Seek>( &self, rw: &mut T, last: u32, count: usize, hint: u32, ) -> Result<u32>

Extend a cluster chain by appending new clusters. Returns the first cluster of the newly allocated portion.

Source§

impl Fat32

Source

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

Read a raw FAT32 entry.

Auto Trait Implementations§

§

impl Freeze for Fat32

§

impl RefUnwindSafe for Fat32

§

impl Send for Fat32

§

impl Sync for Fat32

§

impl Unpin for Fat32

§

impl UnsafeUnpin for Fat32

§

impl UnwindSafe for Fat32

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.