pub struct RawBuffer<T, A: Allocator> { /* private fields */ }Implementations§
Source§impl<T, A: Allocator> RawBuffer<T, A>
impl<T, A: Allocator> RawBuffer<T, A>
Sourcepub const fn new_in(alloc: A) -> Self
pub const fn new_in(alloc: A) -> Self
Like new, but parameterized over the choice of allocator for
the returned RawVec.
pub fn with_capacity_in(capacity: usize, alloc: A) -> Self
pub fn try_with_capacity_in( capacity: usize, alloc: A, ) -> Result<Self, TryReserveError>
pub fn into_raw_parts(self) -> (*mut T, usize, A)
Sourcepub unsafe fn from_raw_parts_in(ptr: *mut T, capacity: usize, alloc: A) -> Self
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.
Sourcepub fn ptr(&self) -> *mut T
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.
pub fn non_null(&self) -> NonNull<T>
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Gets the capacity of the allocation.
This will always be usize::MAX if T is zero-sized.
Sourcepub const fn allocator(&self) -> &A
pub const fn allocator(&self) -> &A
Returns a shared reference to the allocator backing this RawVec.
Sourcepub unsafe fn allocator_mut(&mut self) -> &mut A
pub unsafe fn allocator_mut(&mut self) -> &mut A
§Safety
TODO
Trait Implementations§
Auto Trait Implementations§
impl<T, A> Freeze for RawBuffer<T, A>where
A: Freeze,
impl<T, A> RefUnwindSafe for RawBuffer<T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A> !Send for RawBuffer<T, A>
impl<T, A> !Sync for RawBuffer<T, A>
impl<T, A> Unpin for RawBuffer<T, A>
impl<T, A> UnwindSafe for RawBuffer<T, A>where
A: UnwindSafe,
T: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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