Skip to content

Tracking Issue for ptr::Alignment type #102070

Open
@scottmcm

Description

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

Footnotes

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions