Skip to main content

Alignment

Trait Alignment 

Source
pub trait Alignment:
    Sealed
    + Send
    + Sync
    + 'static
    + Copy
    + Clone {
    const ALIGNMENT: Option<usize>;
    const IS_ALIGNED: bool;
    const ALIGN_BYTES: usize;
}
Expand description

Trait representing a memory alignment guarantee.

Implemented by Zero-Sized Types (ZSTs) representing the alignment layout of the slice.

Required Associated Constants§

Source

const ALIGNMENT: Option<usize>

The alignment boundary in bytes, if statically guaranteed.

Set to Some(N) for aligned views where N is a power of two, or None if there is no static alignment guarantee (i.e. Unaligned).

Source

const IS_ALIGNED: bool

Whether static alignment is guaranteed.

Source

const ALIGN_BYTES: usize

The alignment boundary in bytes (0 if unaligned).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§