fatfs

Struct FormatVolumeOptions

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

A FAT filesystem formatting options

This struct implements a builder pattern. Options are specified as an argument for format_volume function.

Implementations§

Source§

impl FormatVolumeOptions

Source

pub fn new() -> Self

Create options struct for format_volume function

Allows to overwrite many filesystem parameters. In normal use-case defaults should suffice.

Source

pub fn bytes_per_cluster(self, bytes_per_cluster: u32) -> Self

Set size of cluster in bytes (must be dividable by sector size)

Cluster size must be a power of two and be greater or equal to sector size. If option is not specified optimal cluster size is selected based on partition size and optionally FAT type override (if specified using fat_type method).

Source

pub fn fat_type(self, fat_type: FatType) -> Self

Set File Allocation Table type

Option allows to override File Allocation Table (FAT) entry size. It is unrecommended to set this option unless you know what you are doing. Note: FAT type is determined from total number of clusters. Changing this option can cause formatting to fail if the volume cannot be divided into proper number of clusters for selected FAT type.

Source

pub fn bytes_per_sector(self, bytes_per_sector: u16) -> Self

Set sector size in bytes

Sector size must be a power of two and be in range 512 - 4096. Default is 512.

Source

pub fn total_sectors(self, total_sectors: u32) -> Self

Set total number of sectors

If option is not specified total number of sectors is calculated as storage device size divided by sector size.

Source

pub fn max_root_dir_entries(self, max_root_dir_entries: u16) -> Self

Set maximal numer of entries in root directory for FAT12/FAT16 volumes

Total root directory size should be dividable by sectors size so keep it a multiple of 16 (for default sector size). Note: this limit is not used on FAT32 volumes. Default is 512.

Source

pub fn fats(self, fats: u8) -> Self

Set number of File Allocation Tables

The only allowed values are 1 and 2. If value 2 is used the FAT is mirrored. Default is 2.

Source

pub fn media(self, media: u8) -> Self

Set media field for Bios Parameters Block

Default is 0xF8.

Source

pub fn sectors_per_track(self, sectors_per_track: u16) -> Self

Set number of physical sectors per track for Bios Parameters Block (INT 13h CHS geometry)

Default is 0x20.

Source

pub fn heads(self, heads: u16) -> Self

Set number of heads for Bios Parameters Block (INT 13h CHS geometry)

Default is 0x40.

Source

pub fn drive_num(self, drive_num: u8) -> Self

Set drive number for Bios Parameters Block

Default is 0 for FAT12, 0x80 for FAT16/FAT32.

Source

pub fn volume_id(self, volume_id: u32) -> Self

Set volume ID for Bios Parameters Block

Default is 0x12345678.

Source

pub fn volume_label(self, volume_label: [u8; 11]) -> Self

Set volume label

Default is empty label.

Trait Implementations§

Source§

impl Clone for FormatVolumeOptions

Source§

fn clone(&self) -> FormatVolumeOptions

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 FormatVolumeOptions

Source§

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

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

impl Default for FormatVolumeOptions

Source§

fn default() -> FormatVolumeOptions

Returns the “default value” for a type. Read more

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.