Trait bitmac::grow_strategy::GrowStrategy
source · [−]pub trait GrowStrategy {
fn try_grow(
&mut self,
min_req_len: MinimumRequiredLength,
old_len: usize,
bit_idx: usize
) -> Result<FinalLength, ResizeError>;
fn is_force_grow(&self) -> bool { ... }
}
Expand description
Determines strategy of bitmap container growth.
Required Methods
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.
If returns Err(_)
then container is not resized.
Provided Methods
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
)
For performance reasons, all bits outside of the container access are
considered to be 0
. The default behavior is to return false
.