Struct bitmac::resizing_strategy::FixedStrategy
source · [−]#[repr(transparent)]pub struct FixedStrategy(pub usize);Expand description
Increases the size of the container in a fixed increment.
Example:
use bitmac::resizing_strategy::{ResizingStrategy, FixedStrategy, MinimumRequiredLength};
let mut s = FixedStrategy(3);
assert_eq!(s.try_resize(MinimumRequiredLength::new_unchecked(1), 0, 0).unwrap().value(), 3);
assert_eq!(s.try_resize(MinimumRequiredLength::new_unchecked(2), 0, 10).unwrap().value(), 3);
assert_eq!(s.try_resize(MinimumRequiredLength::new_unchecked(3), 0, 23).unwrap().value(), 3);
assert_eq!(s.try_resize(MinimumRequiredLength::new_unchecked(4), 3, 24).unwrap().value(), 6);
assert_eq!(s.try_resize(MinimumRequiredLength::new_unchecked(5), 3, 35).unwrap().value(), 6);
assert_eq!(s.try_resize(MinimumRequiredLength::new_unchecked(6), 3, 47).unwrap().value(), 6);Tuple Fields
0: usizeTrait 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 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
sourcefn ne(&self, other: &FixedStrategy) -> bool
fn ne(&self, other: &FixedStrategy) -> bool
This method tests for !=.
sourceimpl ResizingStrategy for FixedStrategy
impl ResizingStrategy for FixedStrategy
sourcefn try_resize(
&mut self,
min_req_len: MinimumRequiredLength,
_old_len: usize,
_bit_idx: usize
) -> Result<FinalLength, ResizeError>
fn try_resize(
&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 try_resize_opt(
&mut self,
_min_req_len: MinimumRequiredLength,
_old_len: usize,
_bit_idx: usize
) -> Result<Option<FinalLength>, ResizeError>
fn try_resize_opt(
&mut self,
_min_req_len: MinimumRequiredLength,
_old_len: usize,
_bit_idx: usize
) -> Result<Option<FinalLength>, ResizeError>
Will be called when a bitmap needs to resize its container to put a value,
but new bit value is 0 (false), which means container resizing is optional. 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