struct Bpb {
bytes_per_sector: u16,
sectors_per_cluster: u8,
reserved_sectors: u16,
num_fats: u8,
sectors_per_fat_32: u32,
root_cluster: u32,
total_sectors_32: u32,
}Fields§
§bytes_per_sector: u16§sectors_per_cluster: u8§reserved_sectors: u16§num_fats: u8§sectors_per_fat_32: u32§root_cluster: u32§total_sectors_32: u32Implementations§
Source§impl Bpb
impl Bpb
Sourcefn from_bytes(buf: &[u8; 512]) -> Option<Self>
fn from_bytes(buf: &[u8; 512]) -> Option<Self>
Parse a BPB from a 512-byte boot sector buffer.
Validates:
- Boot signature 0x55AA at offset 0x1FE
- FAT32 signature “FAT32 “ at offset 0x52
- Non-zero bytes_per_sector and sectors_per_cluster
- bytes_per_sector is 512 (only 512 supported)
fn bytes_per_cluster(&self) -> u32
fn fat_start_sector(&self) -> u32
fn data_start_sector(&self) -> u32
Sourcefn cluster_to_lba(&self, cluster: u32) -> Option<u32>
fn cluster_to_lba(&self, cluster: u32) -> Option<u32>
Convert a cluster number to the LBA of its first sector. Returns None if the cluster number is invalid.
Sourcefn max_cluster(&self) -> u32
fn max_cluster(&self) -> u32
Maximum valid cluster id for this volume.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Bpb
impl RefUnwindSafe for Bpb
impl Send for Bpb
impl Sync for Bpb
impl Unpin for Bpb
impl UnsafeUnpin for Bpb
impl UnwindSafe for Bpb
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more