Skip to main content

RawBuffer

Struct RawBuffer 

Source
pub struct RawBuffer<T, A: Allocator> { /* private fields */ }

Implementations§

Source§

impl<T, A: Allocator> RawBuffer<T, A>

Source

pub const fn new_in(alloc: A) -> Self

Like new, but parameterized over the choice of allocator for the returned RawVec.

Source

pub fn with_capacity_in(capacity: usize, alloc: A) -> Self

Source

pub fn try_with_capacity_in( capacity: usize, alloc: A, ) -> Result<Self, TryReserveError>

Source

pub fn into_raw_parts(self) -> (*mut T, usize, A)

Source

pub unsafe fn from_raw_parts_in(ptr: *mut T, capacity: usize, alloc: A) -> Self

Reconstitutes a RawBuffer from a pointer, capacity, and allocator.

§Safety

The ptr must be allocated (via the given allocator alloc), and with the given capacity. The capacity cannot exceed isize::MAX for sized types. (only a concern on 32-bit systems). For ZSTs capacity is ignored. If the ptr and capacity come from a RawBuffer created via alloc, then this is guaranteed.

Source

pub fn ptr(&self) -> *mut T

Gets a raw pointer to the start of the allocation. Note that this is Unique::dangling() if capacity == 0 or T is zero-sized. In the former case, you must be careful.

Source

pub fn non_null(&self) -> NonNull<T>

Source

pub fn capacity(&self) -> usize

Gets the capacity of the allocation.

This will always be usize::MAX if T is zero-sized.

Source

pub const fn allocator(&self) -> &A

Returns a shared reference to the allocator backing this RawVec.

Source

pub unsafe fn allocator_mut(&mut self) -> &mut A

§Safety

TODO

Trait Implementations§

Source§

impl<T: Debug, A: Debug + Allocator> Debug for RawBuffer<T, A>

Source§

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

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

impl<T, A: Allocator> Drop for RawBuffer<T, A>

Source§

fn drop(&mut self)

Frees the memory owned by the RawVec without trying to drop its contents.

Auto Trait Implementations§

§

impl<T, A> Freeze for RawBuffer<T, A>
where A: Freeze,

§

impl<T, A> RefUnwindSafe for RawBuffer<T, A>

§

impl<T, A> !Send for RawBuffer<T, A>

§

impl<T, A> !Sync for RawBuffer<T, A>

§

impl<T, A> Unpin for RawBuffer<T, A>
where A: Unpin, T: Unpin,

§

impl<T, A> UnwindSafe for RawBuffer<T, A>
where A: UnwindSafe, T: 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V