pub struct IdRange {
pub start: NonZeroU64,
pub end: NonZeroU64,
}Expand description
Range of raw entity IDs.
start is inclusive, end is exclusive.
IdRangeAllocator provides ranges of IDs.
Fields§
§start: NonZeroU64Start of the range. Inclusive.
end: NonZeroU64End of the range. Exclusive.
Implementations§
source§impl IdRange
impl IdRange
sourcepub fn get(&self, idx: u64) -> Option<NonZeroU64>
pub fn get(&self, idx: u64) -> Option<NonZeroU64>
Returns ID at the given index.
sourcepub fn advance(&mut self, count: u64, f: impl FnMut(NonZeroU64)) -> u64
pub fn advance(&mut self, count: u64, f: impl FnMut(NonZeroU64)) -> u64
Advances range by at most count IDs.
Calls provided closure with each ID.
Returns number of IDs advanced.
sourcepub fn take(&mut self) -> Option<NonZeroU64>
pub fn take(&mut self) -> Option<NonZeroU64>
Take first ID from the range.
Trait Implementations§
source§impl PartialEq for IdRange
impl PartialEq for IdRange
impl Copy for IdRange
impl Eq for IdRange
impl StructuralPartialEq for IdRange
Auto Trait Implementations§
impl Freeze for IdRange
impl RefUnwindSafe for IdRange
impl Send for IdRange
impl Sync for IdRange
impl Unpin for IdRange
impl UnwindSafe for IdRange
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