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

§

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

§

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

§

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.