pub struct Extents { /* private fields */ }Expand description
Container for active mappings associated with a session.
Extents are stored in compact form (ExtentEntry, 16 bytes) in a boxed slice
sorted by ascending end_logical_offset to support clean O(log N) binary search lookups.
Implementations§
Source§impl Extents
impl Extents
Sourcepub fn base_device_offset(&self) -> u64
pub fn base_device_offset(&self) -> u64
Returns the base device offset of this container.
Sourcepub fn try_new(
extents: impl IntoIterator<Item = impl Borrow<Extent>>,
base_device_offset: u64,
) -> Result<Self, Error>
pub fn try_new( extents: impl IntoIterator<Item = impl Borrow<Extent>>, base_device_offset: u64, ) -> Result<Self, Error>
Creates an Extents container from an iterator of Extents, returning an Error
if validation fails.
Sourcepub fn encode(&self) -> impl Iterator<Item = u64> + '_
pub fn encode(&self) -> impl Iterator<Item = u64> + '_
Encodes this Extents container into 64-bit mapping descriptors relative to its base
device offset.
Sourcepub fn encode_extents(extents: &Extents) -> impl Iterator<Item = u64> + '_
pub fn encode_extents(extents: &Extents) -> impl Iterator<Item = u64> + '_
Encodes an Extents container into 64-bit mapping descriptors.
Sourcepub fn encode_extents_with_base_offset(
extents: &Extents,
) -> impl Iterator<Item = u64> + '_
pub fn encode_extents_with_base_offset( extents: &Extents, ) -> impl Iterator<Item = u64> + '_
Encodes an Extents container into 64-bit mapping descriptors relative to its base
device offset.
Sourcepub fn from_encoded(
encoded: impl IntoIterator<Item = u64>,
base_device_offset: u64,
) -> Option<Self>
pub fn from_encoded( encoded: impl IntoIterator<Item = u64>, base_device_offset: u64, ) -> Option<Self>
Decodes a sequence of 64-bit mapping descriptors into a compact Extents container,
offsetting regular extents by base_device_offset.
Returns None if an unknown mapping descriptor type is encountered or if an arithmetic
overflow occurs while decoding.
Sourcepub fn iter_extents(&self, start_offset: u64) -> ExtentsIterator<'_> ⓘ
pub fn iter_extents(&self, start_offset: u64) -> ExtentsIterator<'_> ⓘ
Returns an iterator over all extents whose logical range ends after start_offset,
jumping directly to the first overlapping extent in O(log N) time via binary search.
Trait Implementations§
impl Eq for Extents
impl StructuralPartialEq for Extents
Auto Trait Implementations§
impl Freeze for Extents
impl RefUnwindSafe for Extents
impl Send for Extents
impl Sync for Extents
impl Unpin for Extents
impl UnsafeUnpin for Extents
impl UnwindSafe for Extents
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,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
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> ⓘ
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> ⓘ
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