#[non_exhaustive]pub enum GrowthStrategy {
Exponential {
numerator: usize,
denominator: usize,
},
Linear {
elements: usize,
},
}Expand description
The strategy to employ when growing a vector.
Note that arithmetic overflow is not a concern for any of the strategies: if the final result
of the calculation (in infinite precision) exceeds max_capacity, max_capacity is used as
the new capacity.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Exponential
The current capacity is multiplied by numerator, then divided by denominator.
If the new capacity results in the last committed page having spare room for more elements, those elements are added to the new capacity.
Fields
Linear
elements is added to the current capacity.
If the new capacity results in the last committed page having spare room for more elements, those elements are added to the new capacity.
Implementations§
Trait Implementations§
Source§impl Clone for GrowthStrategy
impl Clone for GrowthStrategy
Source§fn clone(&self) -> GrowthStrategy
fn clone(&self) -> GrowthStrategy
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 GrowthStrategy
impl Debug for GrowthStrategy
Source§impl Default for GrowthStrategy
impl Default for GrowthStrategy
Source§impl Hash for GrowthStrategy
impl Hash for GrowthStrategy
Source§impl PartialEq for GrowthStrategy
impl PartialEq for GrowthStrategy
impl Copy for GrowthStrategy
impl Eq for GrowthStrategy
impl StructuralPartialEq for GrowthStrategy
Auto Trait Implementations§
impl Freeze for GrowthStrategy
impl RefUnwindSafe for GrowthStrategy
impl Send for GrowthStrategy
impl Sync for GrowthStrategy
impl Unpin for GrowthStrategy
impl UnwindSafe for GrowthStrategy
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