pub struct Span<I: DenseId> {
pub start: I,
pub len: I::Index,
}Expand description
A typed span into a flattened persistent pool: start is a typed position
in the target pool (so spans cannot be applied to the wrong pool), len
is in the configured index width. All conversions are checked.
Fields§
§start: I§len: I::IndexImplementations§
Source§impl<I: DenseId> Span<I>
impl<I: DenseId> Span<I>
Sourcepub fn new(start: usize, len: usize) -> Self
pub fn new(start: usize, len: usize) -> Self
Build a span from usize bounds, panicking if either exceeds the configured AU capacity.
start goes through DenseId::try_new, not from_usize: the latter is
documented as unchecked and masks, so a start past I::id_bound() would
silently become a position inside the pool and the span would read some other
entry’s elements as its own. I spans twice the id space (the top bit is the
inline tag), so a pool that outgrows the id bound is representable as a length
but not as a start.
pub fn start_usize(&self) -> usize
pub fn len_usize(&self) -> usize
pub fn end_usize(&self) -> usize
Trait Implementations§
impl<I: Copy + DenseId> Copy for Span<I>
impl<I: Eq + DenseId> Eq for Span<I>
impl<I: PartialEq + DenseId> StructuralPartialEq for Span<I>
Auto Trait Implementations§
impl<I> Freeze for Span<I>
impl<I> RefUnwindSafe for Span<I>
impl<I> Send for Span<I>
impl<I> Sync for Span<I>
impl<I> Unpin for Span<I>
impl<I> UnsafeUnpin for Span<I>
impl<I> UnwindSafe for Span<I>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.