#[repr(C)]
pub union AlignAs<T: Copy, A: Copy> {
// some fields omitted
}
Wrap an object of type T to give it the alignment requirements of an object of type A.
This has a similar effect to #[repr(align(...))], but is parameterized to support the creation
of structures that are generic over alignment.
Example:
extern crate alignas;
use alignas::AlignAs;
use std::{mem, slice};
let mut buffer: AlignAs<_, u64> = AlignAs::new([0u8; 64]);
buffer[3..18].copy_from_slice(b"some input here");
let mut ints = [0u64; 8];
let ptr = &buffer as *const _ as *const u64;
ints.copy_from_slice(unsafe { slice::from_raw_parts(ptr, 8) });
Put the given T object into an aligned location
Mutably dereferences the value.
The resulting type after dereferencing.
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
fn eq(&self, rhs: &Self) -> bool | [src] |
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
| 1.0.0 [src] |
This method tests for !=
.
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the minimum of two values. Read more
This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]
fn lt(&self, other: &Rhs) -> bool
| 1.0.0 [src] |
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
| 1.0.0 [src] |
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
| 1.0.0 [src] |
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
| 1.0.0 [src] |
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
Performs copy-assignment from source
. Read more
Returns the "default value" for a type. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static