Struct bitmac::grow_strategy::MinimumRequiredStrategy
source · [−]pub struct MinimumRequiredStrategy;
Expand description
Increases the size of the container to the minimum required size.
Example:
use bitmac::grow_strategy::{GrowStrategy, MinimumRequiredStrategy, MinimumRequiredLength};
let mut s = MinimumRequiredStrategy;
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(1), 0, 0).unwrap().value(), 1);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(2), 0, 10).unwrap().value(), 2);
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(), 4);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(5), 3, 35).unwrap().value(), 5);
assert_eq!(s.try_grow(MinimumRequiredLength::new_unchecked(6), 3, 47).unwrap().value(), 6);
assert!(!s.is_force_grow());
Trait Implementations
sourceimpl Clone for MinimumRequiredStrategy
impl Clone for MinimumRequiredStrategy
sourcefn clone(&self) -> MinimumRequiredStrategy
fn clone(&self) -> MinimumRequiredStrategy
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 MinimumRequiredStrategy
impl Debug for MinimumRequiredStrategy
sourceimpl Default for MinimumRequiredStrategy
impl Default for MinimumRequiredStrategy
sourcefn default() -> MinimumRequiredStrategy
fn default() -> MinimumRequiredStrategy
Returns the “default value” for a type. Read more
sourceimpl GrowStrategy for MinimumRequiredStrategy
impl GrowStrategy for MinimumRequiredStrategy
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 MinimumRequiredStrategy
impl Hash for MinimumRequiredStrategy
sourceimpl PartialEq<MinimumRequiredStrategy> for MinimumRequiredStrategy
impl PartialEq<MinimumRequiredStrategy> for MinimumRequiredStrategy
sourcefn eq(&self, other: &MinimumRequiredStrategy) -> bool
fn eq(&self, other: &MinimumRequiredStrategy) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Copy for MinimumRequiredStrategy
impl Eq for MinimumRequiredStrategy
impl StructuralEq for MinimumRequiredStrategy
impl StructuralPartialEq for MinimumRequiredStrategy
Auto Trait Implementations
impl RefUnwindSafe for MinimumRequiredStrategy
impl Send for MinimumRequiredStrategy
impl Sync for MinimumRequiredStrategy
impl Unpin for MinimumRequiredStrategy
impl UnwindSafe for MinimumRequiredStrategy
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