Struct aligned_vec::ABox

source ·
pub struct ABox<T: ?Sized, A: Alignment = ConstAlign<CACHELINE_ALIGN>> { /* private fields */ }
Expand description

Aligned box. See Box for more info.

Note: passing an alignment value of 0 or a power of two that is less than the minimum alignment will cause the vector to use the minimum valid alignment for the type T and alignment type A.

Implementations§

source§

impl<T, A: Alignment> ABox<T, A>

source

pub fn new(align: usize, value: T) -> Self

Creates a new ABox<T> containing value at an address aligned to align bytes.

source

pub fn alignment(&self) -> usize

Returns the alignment of the box.

source§

impl<T: ?Sized, A: Alignment> ABox<T, A>

source

pub unsafe fn from_raw_parts(align: usize, ptr: *mut T) -> Self

Creates a new ABox<T> from its raw parts.

§Safety

The arguments to this function must be acquired from a previous call to Self::into_raw_parts.

source

pub fn into_raw_parts(this: Self) -> (*mut T, usize)

Decomposes a ABox<T> into its raw parts: (ptr, alignment).

Trait Implementations§

source§

impl<T: ?Sized, A: Alignment> AsMut<T> for ABox<T, A>

source§

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

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<T: ?Sized, A: Alignment> AsRef<T> for ABox<T, A>

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: Clone, A: Alignment> Clone for ABox<[T], A>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Clone, A: Alignment> Clone for ABox<T, A>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + ?Sized, A: Alignment> Debug for ABox<T, A>

source§

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

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

impl<T: ?Sized, A: Alignment> Deref for ABox<T, A>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: ?Sized, A: Alignment> DerefMut for ABox<T, A>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'de, T: Deserialize<'de>, const N: usize> Deserialize<'de> for ABox<[T], ConstAlign<N>>

Available on crate feature serde only.
source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'de, T: Deserialize<'de>, const N: usize> Deserialize<'de> for ABox<T, ConstAlign<N>>

Available on crate feature serde only.
source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: ?Sized, A: Alignment> Drop for ABox<T, A>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T, A: Alignment> From<ABox<[T], A>> for AVec<T, A>

source§

fn from(value: ABox<[T], A>) -> Self

Converts to this type from the input type.
source§

impl<T: Ord + ?Sized, A: Alignment> Ord for ABox<T, A>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: PartialEq + ?Sized, A: Alignment> PartialEq for ABox<T, A>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd + ?Sized, A: Alignment> PartialOrd for ABox<T, A>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: ?Sized + Serialize, A: Alignment> Serialize for ABox<T, A>

Available on crate feature serde only.
source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Eq + ?Sized, A: Alignment> Eq for ABox<T, A>

source§

impl<T: ?Sized + Send, A: Alignment + Send> Send for ABox<T, A>

source§

impl<T: ?Sized + Sync, A: Alignment + Sync> Sync for ABox<T, A>

Auto Trait Implementations§

§

impl<T, A> Freeze for ABox<T, A>
where A: Freeze, T: ?Sized,

§

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

§

impl<T, A> Unpin for ABox<T, A>
where A: Unpin, T: Unpin + ?Sized,

§

impl<T, A> UnwindSafe for ABox<T, A>

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,