Tracking Issue for ptr::Alignment type · Issue #102070 · rust-lang/rust (original) (raw)

Feature gate: #![feature(ptr_alignment_type)]

This is a tracking issue for the ptr::Alignment type, and related methods, to represent values that are valid alignments in the rust abstract machine.

Public API

// core::ptr

#[derive(Copy, Clone, Eq, PartialEq)] pub struct Alignment(…);

impl Debug for Alignment; impl Ord for Alignment; impl PartialOrd for Alignment; impl Hash for Alignment;

impl Alignment { pub const MIN: Self; pub const fn of() -> Self; pub const fn new(align: usize) -> Option; pub const unsafe fn new_unchecked(align: usize) -> Self; pub const fn as_usize(self) -> usize; pub const fn as_nonzero(self) -> NonZeroUsize; pub const fn log2(self) -> u32; }

impl TryFrom for Alignment; impl TryFrom for Alignment; impl From for NonZeroUsize; impl From for usize;

Steps / History

Unresolved Questions

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html