pub struct CArcArrayBuilder<T, TAllocator: Allocator> { /* private fields */ }Expand description
Implementations§
Source§impl<T, TAllocator: Allocator> CArcArrayBuilder<T, TAllocator>
impl<T, TAllocator: Allocator> CArcArrayBuilder<T, TAllocator>
Sourcepub fn new() -> Result<Self, CArcArrayError>where
TAllocator: Default,
pub fn new() -> Result<Self, CArcArrayError>where
TAllocator: Default,
Creates a new CArcArrayBuilder with the default allocator.
§Notes
This function allocates memory.
§Errors
For details see CArcArrayError.
Sourcepub fn with_capacity(capacity: Length) -> Result<Self, CArcArrayError>where
TAllocator: Default,
pub fn with_capacity(capacity: Length) -> Result<Self, CArcArrayError>where
TAllocator: Default,
Creates a new CArcArrayBuilder with the given capacity and the default allocator.
§Notes
This function allocates memory.
§Errors
For details see CArcArrayError.
Sourcepub fn with_capacity_and_allocator(
capacity: Length,
allocator: TAllocator,
) -> Result<Self, CArcArrayError>
pub fn with_capacity_and_allocator( capacity: Length, allocator: TAllocator, ) -> Result<Self, CArcArrayError>
Creates a new CArcArrayBuilder with the given capacity and allocator.
§Notes
This function allocates memory.
§Errors
For details see CArcArrayError.
Sourcepub fn try_push_slice(&mut self, slice: &[T]) -> Result<(), CArcArrayError>where
T: Clone,
pub fn try_push_slice(&mut self, slice: &[T]) -> Result<(), CArcArrayError>where
T: Clone,
Pushes a new slice to the CArcArrayBuilder.
§Notes
This function clones the data.
§Errors
For details see CArcArrayError.
Sourcepub fn try_push_array<const N: usize>(
&mut self,
array: [T; N],
) -> Result<(), CArcArrayError>
pub fn try_push_array<const N: usize>( &mut self, array: [T; N], ) -> Result<(), CArcArrayError>
Pushes a new array to the CArcArrayBuilder.
§Notes
This function moves the data.
§Errors
For details see CArcArrayError.
Sourcepub fn shrink_to_fit(&mut self) -> Result<(), CArcArrayError>
pub fn shrink_to_fit(&mut self) -> Result<(), CArcArrayError>
Shrinks the underlying buffer to match the length of the buffer exactly.
§Notes
This function may reallocate the underlying buffer, depending on the allocator’s behavior.
§Errors
For details see CArcArrayError.
Sourcepub fn build(self) -> CArcArray<T, TAllocator>
pub fn build(self) -> CArcArray<T, TAllocator>
Builds a new CArcArray out of the CArcArrayBuilder.