fn do_reservation(
		&mut self,
		additional: usize,
		func: impl FnOnce(&mut Vec<T>, usize),
	) {
		let len = self.len();
		let new_len = len.saturating_add(additional);
		Self::assert_len_encodable(new_len);

		let (head, elts) = (self.bitspan.head(), self.bitspan.elements());
		let new_elts =
			crate::mem::elts::<T>(head.into_inner() as usize + new_len);

		let extra_elts = new_elts - elts;
		self.with_vec(|vec| {
			func(&mut **vec, extra_elts);
			//  Ensure that any new elements are initialized.
			vec.resize_with(new_elts, || <T as BitStore>::ZERO);
		});
	}
/// Reserves some memory through the underlying vector.
///
/// ## Parameters
///
/// - `&mut self`
/// - `additional`: The amount of additional space required after
///   `self.len()` in the allocation.
/// - `func`: A function that manipulates the memory reservation of the
///   underlying vector.
///
/// ## Behavior
///
/// `func` should perform the appropriate action to allocate space for at
/// least `additional` more bits. After it returns, the underlying vector is
/// extended with zero-initialized elements until `self.len() + additional`
/// bits have been given initialized memory.
Reserves some memory through the underlying vector.
Reserves some memory through the underlying vector .
fn do_reservation(
		&mut self,
		additional: usize,
		func: impl FnOnce(&mut Vec<T>, usize),
	) {
		let len = self.len();
		let new_len = len.saturating_add(additional);
		Self::assert_len_encodable(new_len);
		let (head, elts) = (self.bitspan.head(), self.bitspan.elements());
		let new_elts =
			crate::mem::elts::<T>(head.into_inner() as usize + new_len);
		let extra_elts = new_elts - elts;
		self.with_vec(|vec| {
			func(&mut **vec, extra_elts);
			//  Ensure that any new elements are initialized.
			vec.resize_with(new_elts, || <T as BitStore>::ZERO);
		});
	}
fn do_reservation ( & mut self , additional : usize , func : impl FnOnce ( & mut Vec < T > , usize ) , ) { let len = self . len ( ) ; let new_len = len . saturating_add ( additional ) ; Self :: assert_len_encodable ( new_len ) ; let ( head , elts ) = ( self . bitspan . head ( ) , self . bitspan . elements ( ) ) ; let new_elts = crate :: mem :: elts :: < T > ( head . into_inner ( ) as usize + new_len ) ; let extra_elts = new_elts - elts ; self . with_vec ( | vec | { func ( & mut * * vec , extra_elts ) ; //  Ensure that any new elements are initialized. vec . resize_with ( new_elts , | | < T as BitStore > :: ZERO ) ; } ) ; }
Reserves some memory through the underlying vector.
Reserves some memory through the underlying vector .
&mut self
additional
usize
func
impl FnOnce(&mut Vec<T>, usize)
&mut self
None
additional
usize
The amount of additional space required after
`self.len()` in the allocation.
The amount of additional space required after ` self . len () ` in the allocation .
func
impl FnOnce(&mut Vec<T>, usize)
A function that manipulates the memory reservation of the
underlying vector.
A function that manipulates the memory reservation of the underlying vector .
behavior
`func` should perform the appropriate action to allocate space for at
least `additional` more bits. After it returns, the underlying vector is
extended with zero-initialized elements until `self.len() + additional`
bits have been given initialized memory.
` func ` should perform the appropriate action to allocate space for at least ` additional ` more bits . After it returns the underlying vector is extended with zero - initialized elements until ` self . len () + additional ` bits have been given initialized memory .