pub struct VecBuilder { /* private fields */ }Expand description
Implementations§
Source§impl VecBuilder
impl VecBuilder
Sourcepub const fn capacity(&mut self, capacity: usize) -> &mut Self
pub const fn capacity(&mut self, capacity: usize) -> &mut Self
The built RawVec will have the minimum capacity required for capacity elements.
The capacity can be greater due to the alignment to the page size.
Sourcepub const fn growth_strategy(
&mut self,
growth_strategy: GrowthStrategy,
) -> &mut Self
pub const fn growth_strategy( &mut self, growth_strategy: GrowthStrategy, ) -> &mut Self
The built RawVec will have the given growth_strategy.
§Panics
Panics if growth_strategy isn’t valid per the documentation of GrowthStrategy.
Sourcepub const fn header(&mut self, header_layout: Layout) -> &mut Self
pub const fn header(&mut self, header_layout: Layout) -> &mut Self
The built RawVec will have a header with the given header_layout.
header_layout.size() bytes will be allocated before the start of the vector’s elements,
with the start aligned to header_layout.align(). You can use RawVec::as_ptr and
offset backwards to access the header.
§Panics
Panics if header_layout is not padded to its alignment.
Sourcepub unsafe fn try_build<T>(&self) -> Result<RawVec<T>, TryReserveError>
pub unsafe fn try_build<T>(&self) -> Result<RawVec<T>, TryReserveError>
Tries to build the RawVec, returning an error when allocation fails.
§Safety
T must be zeroable.
§Errors
- Returns an error if the
max_capacitywould exceedisize::MAXbytes. - Returns an error if the
capacityis greater than themax_capacity. - Returns an error if reserving the allocation returns an error.
Trait Implementations§
Source§impl Clone for VecBuilder
impl Clone for VecBuilder
Source§fn clone(&self) -> VecBuilder
fn clone(&self) -> VecBuilder
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 VecBuilder
impl Debug for VecBuilder
impl Copy for VecBuilder
Auto Trait Implementations§
impl Freeze for VecBuilder
impl RefUnwindSafe for VecBuilder
impl Send for VecBuilder
impl Sync for VecBuilder
impl Unpin for VecBuilder
impl UnwindSafe for VecBuilder
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