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§
Source§impl Clone for MinimumRequiredStrategy
impl Clone for MinimumRequiredStrategy
Source§fn clone(&self) -> MinimumRequiredStrategy
fn clone(&self) -> MinimumRequiredStrategy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MinimumRequiredStrategy
impl Debug for MinimumRequiredStrategy
Source§impl Default for MinimumRequiredStrategy
impl Default for MinimumRequiredStrategy
Source§fn default() -> MinimumRequiredStrategy
fn default() -> MinimumRequiredStrategy
Returns the “default value” for a type. Read more
Source§impl GrowStrategy for MinimumRequiredStrategy
impl GrowStrategy for MinimumRequiredStrategy
Source§fn 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
Source§fn 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 moreSource§impl Hash for MinimumRequiredStrategy
impl Hash for MinimumRequiredStrategy
Source§impl PartialEq for MinimumRequiredStrategy
impl PartialEq for MinimumRequiredStrategy
impl Copy for MinimumRequiredStrategy
impl Eq for MinimumRequiredStrategy
impl StructuralPartialEq for MinimumRequiredStrategy
Auto Trait Implementations§
impl Freeze for MinimumRequiredStrategy
impl RefUnwindSafe for MinimumRequiredStrategy
impl Send for MinimumRequiredStrategy
impl Sync for MinimumRequiredStrategy
impl Unpin for MinimumRequiredStrategy
impl UnwindSafe for MinimumRequiredStrategy
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