Struct bitmac::grow_strategy::FixedStrategy
source · [−]#[repr(transparent)]pub struct FixedStrategy(pub usize);
Expand description
Increases the size of the container by a fixed increment.
Example:
use bitmac::grow_strategy::{GrowStrategy, FixedStrategy, MinimumRequiredLength};
let mut s = FixedStrategy(3);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(1), 0, 0).unwrap().value(), 3);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(2), 0, 10).unwrap().value(), 3);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(3), 0, 23).unwrap().value(), 3);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(4), 3, 24).unwrap().value(), 6);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(5), 3, 35).unwrap().value(), 6);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(6), 3, 47).unwrap().value(), 6);
assert!(!s.is_force_grow());
Tuple Fields
0: usize
Trait Implementations
sourceimpl Clone for FixedStrategy
impl Clone for FixedStrategy
sourcefn clone(&self) -> FixedStrategy
fn clone(&self) -> FixedStrategy
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for FixedStrategy
impl Debug for FixedStrategy
sourceimpl GrowStrategy for FixedStrategy
impl GrowStrategy for FixedStrategy
sourcefn try_grow(
&mut self,
min_req_len: MinimumRequiredLength,
_old_len: usize,
_bit_idx: usize
) -> Result<FinalLength, ResizeError>
fn try_grow(
&mut self,
min_req_len: MinimumRequiredLength,
_old_len: usize,
_bit_idx: usize
) -> Result<FinalLength, ResizeError>
Will be called when the bitmap needs to extend its container. New length always >= minimal required length of container. Read more
sourcefn is_force_grow(&self) -> bool
fn is_force_grow(&self) -> bool
Checks if the container should grow if the changing bit is exceeding container’s length
and its new state is 0
(false
) Read more
sourceimpl Hash for FixedStrategy
impl Hash for FixedStrategy
sourceimpl PartialEq<FixedStrategy> for FixedStrategy
impl PartialEq<FixedStrategy> for FixedStrategy
sourcefn eq(&self, other: &FixedStrategy) -> bool
fn eq(&self, other: &FixedStrategy) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Copy for FixedStrategy
impl Eq for FixedStrategy
impl StructuralEq for FixedStrategy
impl StructuralPartialEq for FixedStrategy
Auto Trait Implementations
impl RefUnwindSafe for FixedStrategy
impl Send for FixedStrategy
impl Sync for FixedStrategy
impl Unpin for FixedStrategy
impl UnwindSafe for FixedStrategy
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more