pub struct SlotRange { /* private fields */ }Expand description
An inclusive [start, end] slot range. Construct via SlotRange::new,
which rejects an inverted range, or SlotRange::new_unchecked where the
ordering is already guaranteed by the caller.
Implementations§
Source§impl SlotRange
impl SlotRange
Sourcepub fn new(start: u64, end: u64) -> Result<Self, InvertedSlotRange>
pub fn new(start: u64, end: u64) -> Result<Self, InvertedSlotRange>
An inclusive range, rejecting start > end.
Sourcepub const fn new_unchecked(start: u64, end: u64) -> Self
pub const fn new_unchecked(start: u64, end: u64) -> Self
A range whose ordering the caller already guarantees — e.g. one derived
from a start plus a non-zero count. Prefer SlotRange::new.
Sourcepub const fn from_count(start: u64, count: u64) -> Self
pub const fn from_count(start: u64, count: u64) -> Self
The range covering count slots from start. count of 0 yields a
single-slot range, matching how the callers’ slot counts behave.
pub const fn start(&self) -> u64
pub const fn end(&self) -> u64
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Never true — an inclusive range always covers at least one slot. Present
so len() doesn’t trip clippy::len_without_is_empty.
pub const fn contains(&self, slot: u64) -> bool
Trait Implementations§
impl Copy for SlotRange
Source§impl<'de> Deserialize<'de> for SlotRange
impl<'de> Deserialize<'de> for SlotRange
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SlotRange
Source§impl Ord for SlotRange
impl Ord for SlotRange
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for SlotRange
impl PartialOrd for SlotRange
impl StructuralPartialEq for SlotRange
Auto Trait Implementations§
impl Freeze for SlotRange
impl RefUnwindSafe for SlotRange
impl Send for SlotRange
impl Sync for SlotRange
impl Unpin for SlotRange
impl UnsafeUnpin for SlotRange
impl UnwindSafe for SlotRange
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