View all comments
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<T>() -> Self;
pub const fn new(align: usize) -> Option<Self>;
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<NonZeroUsize> for Alignment;
impl TryFrom<usize> for Alignment;
impl From<Alignment> for NonZeroUsize;
impl From<Alignment> for usize;
Steps / History
Unresolved Questions
View all comments
Feature gate:
#![feature(ptr_alignment_type)]This is a tracking issue for the
ptr::Alignmenttype, and related methods, to represent values that are valid alignments in the rust abstract machine.Public API
Steps / History
ptr::Alignmenttype #102072Unresolved Questions
maskmethod (from impl more traits for ptr::Alignment, add mask method #115249) correct? Should it be!(a - 1)ora - 1? Should it have a different name to distinguish it more from<*const _>::mask?Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩