pub struct BoxA<T: ?Sized, A: Allocator> { /* private fields */ }Expand description
A pointer type that uniquely owns a heap allocation of type T.
dyn values can be boxed using the unsize_box macro.
Implementations§
Source§impl<T, A: Allocator> BoxA<T, A>
impl<T, A: Allocator> BoxA<T, A>
Source§impl<T: ?Sized, A: Allocator> BoxA<T, A>
impl<T: ?Sized, A: Allocator> BoxA<T, A>
Sourcepub fn from_str(s: &str) -> BoxA<str, A>where
A: Default,
pub fn from_str(s: &str) -> BoxA<str, A>where
A: Default,
Allocates memory then copies s into it.
Sourcepub fn from_str_in(s: &str, a: A) -> BoxA<str, A>
pub fn from_str_in(s: &str, a: A) -> BoxA<str, A>
Allocates memory in the given allocator then copies s into it.
Note: there is currently no equivalent in the standard library.
Sourcepub fn into_raw_with_allocator(b: Self) -> (*mut T, A)
pub fn into_raw_with_allocator(b: Self) -> (*mut T, A)
Convert into raw pointer and allocator.
Sourcepub unsafe fn from_raw_in(p: *mut T, a: A) -> Self
pub unsafe fn from_raw_in(p: *mut T, a: A) -> Self
Create from raw pointer in specified allocator.
§Safety
This function is unsafe because improper use may lead to memory problems. For example, a double-free may occur if the function is called twice on the same raw pointer.
The non-null pointer must point to a block of memory allocated by a.
Trait Implementations§
Source§impl<T: ?Sized, A: Allocator> BorrowMut<T> for BoxA<T, A>
impl<T: ?Sized, A: Allocator> BorrowMut<T> for BoxA<T, A>
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<'de, T, A> Deserialize<'de> for BoxA<T, A>
Available on crate feature serde only.
impl<'de, T, A> Deserialize<'de> for BoxA<T, A>
Available on crate feature
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl<T: ?Sized + Eq, A: Allocator> Eq for BoxA<T, A>
Source§impl<T: ?Sized + Ord, A: Allocator> Ord for BoxA<T, A>
impl<T: ?Sized + Ord, A: Allocator> Ord for BoxA<T, A>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for BoxA<T, A>
impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for BoxA<T, A>
impl<T: ?Sized + Send, A: Allocator + Send> Send for BoxA<T, A>
impl<T: ?Sized + Sync, A: Allocator + Sync> Sync for BoxA<T, A>
Auto Trait Implementations§
impl<T, A> Freeze for BoxA<T, A>
impl<T, A> RefUnwindSafe for BoxA<T, A>
impl<T, A> Unpin for BoxA<T, A>
impl<T, A> UnsafeUnpin for BoxA<T, A>where
A: UnsafeUnpin,
T: ?Sized,
impl<T, A> UnwindSafe for BoxA<T, A>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.