pub struct Extent {
pub sector: u32,
pub length: u64,
/* private fields */
}Expand description
A contiguous region on disk, identified by a starting sector and byte length.
§Example
use hadris_common::types::extent::Extent;
let extent = Extent::new(100, 4096);
assert_eq!(extent.sector, 100);
assert_eq!(extent.length, 4096);
assert_eq!(extent.sector_count(2048), 2);
assert_eq!(extent.end_sector(2048), 102);
assert!(!extent.is_empty());Fields§
§sector: u32Starting logical sector (LBA).
length: u64Size in bytes.
Implementations§
Source§impl Extent
impl Extent
Sourcepub const fn end_sector(&self, sector_size: u32) -> u32
pub const fn end_sector(&self, sector_size: u32) -> u32
Returns the end sector (exclusive) based on the given sector size.
Sourcepub const fn sector_count(&self, sector_size: u32) -> u32
pub const fn sector_count(&self, sector_size: u32) -> u32
Returns the number of sectors this extent spans.
Trait Implementations§
impl Copy for Extent
impl Eq for Extent
impl Pod for Extent
impl StructuralPartialEq for Extent
Auto Trait Implementations§
impl Freeze for Extent
impl RefUnwindSafe for Extent
impl Send for Extent
impl Sync for Extent
impl Unpin for Extent
impl UnsafeUnpin for Extent
impl UnwindSafe for Extent
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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.