Skip to content

Commit

Permalink
From<Alignment> for usize & NonZeroUsize
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm committed Oct 9, 2022
1 parent e07250d commit d7c692a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/src/ptr/alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ impl TryFrom<usize> for Alignment {
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl From<Alignment> for NonZeroUsize {
#[inline]
fn from(align: Alignment) -> NonZeroUsize {
align.as_nonzero()
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl From<Alignment> for usize {
#[inline]
fn from(align: Alignment) -> usize {
align.as_usize()
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl cmp::Ord for Alignment {
#[inline]
Expand Down

0 comments on commit d7c692a

Please sign in to comment.