Struct dungeon_cell::Alignment

source ·
pub struct Alignment<const N: usize> { /* private fields */ }
Expand description

Alignment in bytes.

This is the type to use where ValidAlignment is required.

Alignment values with a power of two from 1 up to 2²⁹ are allowed as given by the rust reference.

By storing the associated Marker, a type will gain an alignment requirement equal to the const generic on Alignment.

Examples

use std::mem::align_of;
use dungeon_cell::{Alignment, valid_generic_markers::ValidAlignment};

struct Test<A: ValidAlignment> {
    _marker: A::Marker,
}

assert_eq!(align_of::<Test::<Alignment<8>>>(), 8);
assert_eq!(align_of::<Test::<Alignment<16>>>(), 16);

Trait Implementations§

source§

impl ValidAlignment for Alignment<1>

source§

const VALUE: usize = 1usize

Alignment of the associated Self::Marker.
§

type Marker = Marker0

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker0 = Marker0

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<1024>

source§

const VALUE: usize = 1_024usize

Alignment of the associated Self::Marker.
§

type Marker = Marker10

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker10 = Marker10

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<1048576>

source§

const VALUE: usize = 1_048_576usize

Alignment of the associated Self::Marker.
§

type Marker = Marker20

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker20 = Marker20

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<128>

source§

const VALUE: usize = 128usize

Alignment of the associated Self::Marker.
§

type Marker = Marker7

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker7 = Marker7

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<131072>

source§

const VALUE: usize = 131_072usize

Alignment of the associated Self::Marker.
§

type Marker = Marker17

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker17 = Marker17

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<134217728>

source§

const VALUE: usize = 134_217_728usize

Alignment of the associated Self::Marker.
§

type Marker = Marker27

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker27 = Marker27

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<16>

source§

const VALUE: usize = 16usize

Alignment of the associated Self::Marker.
§

type Marker = Marker4

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker4 = Marker4

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<16384>

source§

const VALUE: usize = 16_384usize

Alignment of the associated Self::Marker.
§

type Marker = Marker14

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker14 = Marker14

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<16777216>

source§

const VALUE: usize = 16_777_216usize

Alignment of the associated Self::Marker.
§

type Marker = Marker24

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker24 = Marker24

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<2>

source§

const VALUE: usize = 2usize

Alignment of the associated Self::Marker.
§

type Marker = Marker1

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker1 = Marker1

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<2048>

source§

const VALUE: usize = 2_048usize

Alignment of the associated Self::Marker.
§

type Marker = Marker11

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker11 = Marker11

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<2097152>

source§

const VALUE: usize = 2_097_152usize

Alignment of the associated Self::Marker.
§

type Marker = Marker21

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker21 = Marker21

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<256>

source§

const VALUE: usize = 256usize

Alignment of the associated Self::Marker.
§

type Marker = Marker8

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker8 = Marker8

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<262144>

source§

const VALUE: usize = 262_144usize

Alignment of the associated Self::Marker.
§

type Marker = Marker18

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker18 = Marker18

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<268435456>

source§

const VALUE: usize = 268_435_456usize

Alignment of the associated Self::Marker.
§

type Marker = Marker28

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker28 = Marker28

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<32>

source§

const VALUE: usize = 32usize

Alignment of the associated Self::Marker.
§

type Marker = Marker5

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker5 = Marker5

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<32768>

source§

const VALUE: usize = 32_768usize

Alignment of the associated Self::Marker.
§

type Marker = Marker15

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker15 = Marker15

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<33554432>

source§

const VALUE: usize = 33_554_432usize

Alignment of the associated Self::Marker.
§

type Marker = Marker25

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker25 = Marker25

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<4>

source§

const VALUE: usize = 4usize

Alignment of the associated Self::Marker.
§

type Marker = Marker2

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker2 = Marker2

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<4096>

source§

const VALUE: usize = 4_096usize

Alignment of the associated Self::Marker.
§

type Marker = Marker12

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker12 = Marker12

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<4194304>

source§

const VALUE: usize = 4_194_304usize

Alignment of the associated Self::Marker.
§

type Marker = Marker22

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker22 = Marker22

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<512>

source§

const VALUE: usize = 512usize

Alignment of the associated Self::Marker.
§

type Marker = Marker9

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker9 = Marker9

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<524288>

source§

const VALUE: usize = 524_288usize

Alignment of the associated Self::Marker.
§

type Marker = Marker19

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker19 = Marker19

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<536870912>

source§

const VALUE: usize = 536_870_912usize

Alignment of the associated Self::Marker.
§

type Marker = Marker29

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker29 = Marker29

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<64>

source§

const VALUE: usize = 64usize

Alignment of the associated Self::Marker.
§

type Marker = Marker6

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker6 = Marker6

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<65536>

source§

const VALUE: usize = 65_536usize

Alignment of the associated Self::Marker.
§

type Marker = Marker16

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker16 = Marker16

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<67108864>

source§

const VALUE: usize = 67_108_864usize

Alignment of the associated Self::Marker.
§

type Marker = Marker26

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker26 = Marker26

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<8>

source§

const VALUE: usize = 8usize

Alignment of the associated Self::Marker.
§

type Marker = Marker3

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker3 = Marker3

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<8192>

source§

const VALUE: usize = 8_192usize

Alignment of the associated Self::Marker.
§

type Marker = Marker13

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker13 = Marker13

Instance of the associated Self::Marker.
source§

impl ValidAlignment for Alignment<8388608>

source§

const VALUE: usize = 8_388_608usize

Alignment of the associated Self::Marker.
§

type Marker = Marker23

Type of alignment marker.
source§

const MARKER_INSTANCE: Marker23 = Marker23

Instance of the associated Self::Marker.

Auto Trait Implementations§

§

impl<const N: usize> RefUnwindSafe for Alignment<N>

§

impl<const N: usize> Send for Alignment<N>

§

impl<const N: usize> Sync for Alignment<N>

§

impl<const N: usize> Unpin for Alignment<N>

§

impl<const N: usize> UnwindSafe for Alignment<N>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for Twhere W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.