Skip to main content

CArcArrayBuilder

Struct CArcArrayBuilder 

Source
pub struct CArcArrayBuilder<T, TAllocator: Allocator> { /* private fields */ }
Expand description

This is a builder for CArcArray. It is used to iteratively construct a CArcArray, without the need of intermediate allocations.

Implementations§

Source§

impl<T, TAllocator: Allocator> CArcArrayBuilder<T, TAllocator>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn build(self) -> CArcArray<T, TAllocator>

Builds a new CArcArray out of the CArcArrayBuilder.

Trait Implementations§

Source§

impl<T: Debug, TAllocator: Debug + Allocator> Debug for CArcArrayBuilder<T, TAllocator>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, TAllocator: Allocator> Drop for CArcArrayBuilder<T, TAllocator>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: ReprC, TAllocator: Allocator> ReprC for CArcArrayBuilder<T, TAllocator>

Source§

const CHECK: ()

This field is used for const checks only.

Auto Trait Implementations§

§

impl<T, TAllocator> Freeze for CArcArrayBuilder<T, TAllocator>

§

impl<T, TAllocator> RefUnwindSafe for CArcArrayBuilder<T, TAllocator>
where T: RefUnwindSafe, TAllocator: RefUnwindSafe,

§

impl<T, TAllocator> Send for CArcArrayBuilder<T, TAllocator>
where T: Send, TAllocator: Send,

§

impl<T, TAllocator> Sync for CArcArrayBuilder<T, TAllocator>
where T: Sync, TAllocator: Sync,

§

impl<T, TAllocator> Unpin for CArcArrayBuilder<T, TAllocator>
where T: Unpin, TAllocator: Unpin,

§

impl<T, TAllocator> UnsafeUnpin for CArcArrayBuilder<T, TAllocator>

§

impl<T, TAllocator> UnwindSafe for CArcArrayBuilder<T, TAllocator>
where T: UnwindSafe, TAllocator: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.