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
impl FormatVolumeOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Create options struct for format_volume
function
Allows to overwrite many filesystem parameters. In normal use-case defaults should suffice.
Sourcepub fn bytes_per_cluster(self, bytes_per_cluster: u32) -> Self
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).
Sourcepub fn fat_type(self, fat_type: FatType) -> Self
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.
Sourcepub fn bytes_per_sector(self, bytes_per_sector: u16) -> Self
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
.
Sourcepub fn total_sectors(self, total_sectors: u32) -> Self
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.
Sourcepub fn max_root_dir_entries(self, max_root_dir_entries: u16) -> Self
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
.
Sourcepub fn fats(self, fats: u8) -> Self
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
.
Sourcepub fn media(self, media: u8) -> Self
pub fn media(self, media: u8) -> Self
Set media field for Bios Parameters Block
Default is 0xF8
.
Sourcepub fn sectors_per_track(self, sectors_per_track: u16) -> Self
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
.
Sourcepub fn heads(self, heads: u16) -> Self
pub fn heads(self, heads: u16) -> Self
Set number of heads for Bios Parameters Block (INT 13h CHS geometry)
Default is 0x40
.
Sourcepub fn drive_num(self, drive_num: u8) -> Self
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.
Sourcepub fn volume_id(self, volume_id: u32) -> Self
pub fn volume_id(self, volume_id: u32) -> Self
Set volume ID for Bios Parameters Block
Default is 0x12345678
.
Sourcepub fn volume_label(self, volume_label: [u8; 11]) -> Self
pub fn volume_label(self, volume_label: [u8; 11]) -> Self
Set volume label
Default is empty label.
Trait Implementations§
Source§impl Clone for FormatVolumeOptions
impl Clone for FormatVolumeOptions
Source§fn clone(&self) -> FormatVolumeOptions
fn clone(&self) -> FormatVolumeOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FormatVolumeOptions
impl Debug for FormatVolumeOptions
Source§impl Default for FormatVolumeOptions
impl Default for FormatVolumeOptions
Source§fn default() -> FormatVolumeOptions
fn default() -> FormatVolumeOptions
Auto Trait Implementations§
impl Freeze for FormatVolumeOptions
impl RefUnwindSafe for FormatVolumeOptions
impl Send for FormatVolumeOptions
impl Sync for FormatVolumeOptions
impl Unpin for FormatVolumeOptions
impl UnwindSafe for FormatVolumeOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)