pub struct SmallInts<F: Integer + Bounded + NumCast + Copy, B: Integer + NumCast + Copy> { /* private fields */ }
Expand description
Data structure for storing a sequence of small integers with few big ones space efficiently while supporting classical vector operations.
Implementations
sourceimpl<S: Integer + Bounded + NumCast + Copy, B: Integer + NumCast + Copy> SmallInts<S, B>
impl<S: Integer + Bounded + NumCast + Copy, B: Integer + NumCast + Copy> SmallInts<S, B>
sourcepub fn with_capacity(n: usize) -> Self
pub fn with_capacity(n: usize) -> Self
Create a new instance with a given capacity.
sourcepub fn from_elem(v: S, n: usize) -> Self
pub fn from_elem(v: S, n: usize) -> Self
Create a new instance containing n
times the integer v
(and v
is expected to be small).
sourcepub fn push(&mut self, v: B)
pub fn push(&mut self, v: B)
Append v
to the sequence. This will determine whether v
is big or small and store it accordingly.
sourcepub fn set(&mut self, i: usize, v: B)
pub fn set(&mut self, i: usize, v: B)
Set value of position i
to v
. This will determine whether v
is big or small and store it accordingly.
sourcepub fn iter(&self) -> Iter<'_, S, B>ⓘNotable traits for Iter<'a, S, B>impl<'a, S, B> Iterator for Iter<'a, S, B> where
S: 'a + Integer + Bounded + NumCast + Copy,
B: 'a + Integer + NumCast + Copy,
<S as Num>::FromStrRadixErr: 'a,
<B as Num>::FromStrRadixErr: 'a, type Item = B;
pub fn iter(&self) -> Iter<'_, S, B>ⓘNotable traits for Iter<'a, S, B>impl<'a, S, B> Iterator for Iter<'a, S, B> where
S: 'a + Integer + Bounded + NumCast + Copy,
B: 'a + Integer + NumCast + Copy,
<S as Num>::FromStrRadixErr: 'a,
<B as Num>::FromStrRadixErr: 'a, type Item = B;
S: 'a + Integer + Bounded + NumCast + Copy,
B: 'a + Integer + NumCast + Copy,
<S as Num>::FromStrRadixErr: 'a,
<B as Num>::FromStrRadixErr: 'a, type Item = B;
Iterate over sequence. Values will be returned in the big integer type (B
).
Trait Implementations
sourceimpl<S: Integer + Bounded + NumCast + Copy, B: Integer + NumCast + Copy> Default for SmallInts<S, B>
impl<S: Integer + Bounded + NumCast + Copy, B: Integer + NumCast + Copy> Default for SmallInts<S, B>
sourceimpl<'de, F: Integer + Bounded + NumCast + Copy, B: Integer + NumCast + Copy> Deserialize<'de> for SmallInts<F, B> where
F: Deserialize<'de>,
B: Deserialize<'de>,
impl<'de, F: Integer + Bounded + NumCast + Copy, B: Integer + NumCast + Copy> Deserialize<'de> for SmallInts<F, B> where
F: Deserialize<'de>,
B: Deserialize<'de>,
sourcefn 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
Auto Trait Implementations
impl<F, B> RefUnwindSafe for SmallInts<F, B> where
B: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, B> Send for SmallInts<F, B> where
B: Send,
F: Send,
impl<F, B> Sync for SmallInts<F, B> where
B: Sync,
F: Sync,
impl<F, B> Unpin for SmallInts<F, B> where
F: Unpin,
impl<F, B> UnwindSafe for SmallInts<F, B> where
B: RefUnwindSafe,
F: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.