Aligned in rustc_data_structures::aligned - Rust
Description: A type with a statically known alignment.

Skip to main content

## Aligned

# Trait Aligned

Source

    pub unsafe trait Aligned: PointeeSized {
        const ALIGN: Alignment;
    }

Expand description

A type with a statically known alignment.

## §Safety

`Self::ALIGN` must be equal to the alignment of `Self`. For sized types it is `align_of::<Self>()`, for unsized types it depends on the type, for example `[T]` has alignment of `T`.

## Required Associated Constants§

Source

#### const ALIGN: Alignment

Alignment of `Self`.

## Dyn Compatibility§

This trait is not dyn compatible.

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

## Implementations on Foreign Types§

Source§

### impl<T> Aligned for [T]

Source§

#### const ALIGN: Alignment

## Implementors§

Source§

### impl<T> Aligned for T

Source§

#### const ALIGN: Alignment