pub enum IntSlice {
Owned(Box<[usize]>),
Java(JavaPermutation),
Epserde(MemCase<Box<[usize]>>),
BitFieldVec(MemCase<BitFieldVec>),
}Expand description
Loaded integer slice, returned by IntSliceFormat::load.
Depending on the format, the data may be backed by a memory-mapped file
(Java, ε-serde, and BitFieldVec) or fully loaded into memory (ASCII,
JSON).
This enum implements SliceByValue with Value = usize, so it can
be used directly wherever a SliceByValue is expected. However, each
access goes through enum dispatch, which may be undesirable in
performance-critical code.
For native, dispatch-free access, match on the variants and use each
inner type directly—they all implement SliceByValue<Value = usize>:
match args.fmt.load(&path)? {
IntSlice::Owned(v) => do_transform(&v, ...),
IntSlice::Java(j) => do_transform(&j, ...),
IntSlice::Epserde(m) => do_transform(m.uncase(), ...),
IntSlice::BitFieldVec(m) => do_transform(m.uncase(), ...),
}This incurs one monomorphization of do_transform per arm; arms that
share the same inner type can be merged to reduce monomorphization cost.
Variants§
Owned(Box<[usize]>)
Fully loaded into memory (ASCII, JSON).
Java(JavaPermutation)
Memory-mapped Java big-endian format (64-bit only).
Epserde(MemCase<Box<[usize]>>)
Memory-mapped ε-serde serialized slice.
BitFieldVec(MemCase<BitFieldVec>)
Memory-mapped ε-serde serialized BitFieldVec.
Trait Implementations§
Source§impl SliceByValue for IntSlice
impl SliceByValue for IntSlice
Source§unsafe fn get_value_unchecked(&self, index: usize) -> usize
unsafe fn get_value_unchecked(&self, index: usize) -> usize
Source§fn len(&self) -> usize
fn len(&self) -> usize
slice::len.Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
slice::is_empty.Source§fn index_value(&self, index: usize) -> Self::Value
fn index_value(&self, index: usize) -> Self::Value
Auto Trait Implementations§
impl Freeze for IntSlice
impl RefUnwindSafe for IntSlice
impl Send for IntSlice
impl Sync for IntSlice
impl Unpin for IntSlice
impl UnsafeUnpin for IntSlice
impl UnwindSafe for IntSlice
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> EitherFullOrEpsCopy<T> for Twhere
T: ?Sized,
impl<T> FullCopyConsistent<T> for Twhere
T: ?Sized,
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