1.28.0[−][src]Struct core::num::NonZeroU8
An integer that is known not to equal zero.
This enables some memory layout optimization.
For example, Option<NonZeroU8>
is the same size as u8
:
use std::mem::size_of; assert_eq!(size_of::<Option<core::num::NonZeroU8>>(), size_of::<u8>());Run
Methods
impl NonZeroU8
[src][−]
pub const unsafe fn new_unchecked(n: u8) -> Self
[src][−]
pub fn new(n: u8) -> Option<Self>
[src][−]
Creates a non-zero if the given value is not zero.
pub const fn get(self) -> u8
[src][−]
Returns the value as a primitive type.
Trait Implementations
impl Copy for NonZeroU8
[src]
impl PartialEq<NonZeroU8> for NonZeroU8
[src][+]
impl Eq for NonZeroU8
[src]
impl Ord for NonZeroU8
[src][+]
impl PartialOrd<NonZeroU8> for NonZeroU8
[src][+]
impl Clone for NonZeroU8
[src][+]
impl From<NonZeroU8> for u8
1.31.0[src][+]
impl FromStr for NonZeroU8
1.35.0[src][+]
impl Hash for NonZeroU8
[src][+]
impl Debug for NonZeroU8
[src][+]
impl Display for NonZeroU8
[src][+]
impl Octal for NonZeroU8
[src][+]
impl Binary for NonZeroU8
[src][+]
impl LowerHex for NonZeroU8
[src][+]
impl UpperHex for NonZeroU8
[src][+]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> From<T> for T
[src][+]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,