Struct ockam_core::lib::num::NonZeroIsize 1.34.0[−][src]
#[repr(transparent)]pub struct NonZeroIsize(_);
An integer that is known not to equal zero.
This enables some memory layout optimization.
For example, Option<NonZeroIsize>
is the same size as isize
:
use std::mem::size_of; assert_eq!(size_of::<Option<core::num::NonZeroIsize>>(), size_of::<isize>());
Implementations
impl NonZeroIsize
[src]
impl NonZeroIsize
[src]pub const unsafe fn new_unchecked(n: isize) -> NonZeroIsize
1.34.0 (const: 1.34.0)[src]
pub const fn new(n: isize) -> Option<NonZeroIsize>
1.34.0 (const: 1.47.0)[src]
Creates a non-zero if the given value is not zero.
pub const fn get(self) -> isize
1.34.0 (const: 1.34.0)[src]
Returns the value as a primitive type.
impl NonZeroIsize
[src]
impl NonZeroIsize
[src]pub const fn leading_zeros(self) -> u32
1.53.0 (const: 1.53.0)[src]
Returns the number of leading zeros in the binary representation of self
.
On many architectures, this function can perform better than leading_zeros()
on the underlying integer type, as special handling of zero can be avoided.
Examples
Basic usage:
let n = std::num::NonZeroIsize::new(-1isize).unwrap(); assert_eq!(n.leading_zeros(), 0);
pub const fn trailing_zeros(self) -> u32
1.53.0 (const: 1.53.0)[src]
Returns the number of trailing zeros in the binary representation
of self
.
On many architectures, this function can perform better than trailing_zeros()
on the underlying integer type, as special handling of zero can be avoided.
Examples
Basic usage:
let n = std::num::NonZeroIsize::new(0b0101000).unwrap(); assert_eq!(n.trailing_zeros(), 3);
Trait Implementations
impl BitOr<NonZeroIsize> for NonZeroIsize
1.45.0[src]
impl BitOr<NonZeroIsize> for NonZeroIsize
1.45.0[src]type Output = NonZeroIsize
The resulting type after applying the |
operator.
pub fn bitor(
self,
rhs: NonZeroIsize
) -> <NonZeroIsize as BitOr<NonZeroIsize>>::Output
[src]
self,
rhs: NonZeroIsize
) -> <NonZeroIsize as BitOr<NonZeroIsize>>::Output
impl BitOr<NonZeroIsize> for isize
1.45.0[src]
impl BitOr<NonZeroIsize> for isize
1.45.0[src]type Output = NonZeroIsize
The resulting type after applying the |
operator.
pub fn bitor(self, rhs: NonZeroIsize) -> <isize as BitOr<NonZeroIsize>>::Output
[src]
impl BitOr<isize> for NonZeroIsize
1.45.0[src]
impl BitOr<isize> for NonZeroIsize
1.45.0[src]type Output = NonZeroIsize
The resulting type after applying the |
operator.
pub fn bitor(self, rhs: isize) -> <NonZeroIsize as BitOr<isize>>::Output
[src]
impl BitOrAssign<NonZeroIsize> for NonZeroIsize
1.45.0[src]
impl BitOrAssign<NonZeroIsize> for NonZeroIsize
1.45.0[src]pub fn bitor_assign(&mut self, rhs: NonZeroIsize)
[src]
impl BitOrAssign<isize> for NonZeroIsize
1.45.0[src]
impl BitOrAssign<isize> for NonZeroIsize
1.45.0[src]pub fn bitor_assign(&mut self, rhs: isize)
[src]
impl Clone for NonZeroIsize
[src]
impl Clone for NonZeroIsize
[src]pub fn clone(&self) -> NonZeroIsize
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for NonZeroIsize
[src]
impl Copy for NonZeroIsize
[src]impl<'de> Deserialize<'de> for NonZeroIsize
[src]
impl<'de> Deserialize<'de> for NonZeroIsize
[src]pub fn deserialize<D>(
deserializer: D
) -> Result<NonZeroIsize, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
deserializer: D
) -> Result<NonZeroIsize, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl Display for NonZeroIsize
[src]
impl Display for NonZeroIsize
[src]impl Eq for NonZeroIsize
[src]
impl Eq for NonZeroIsize
[src]impl From<NonZeroI16> for NonZeroIsize
1.41.0[src]
impl From<NonZeroI16> for NonZeroIsize
1.41.0[src]pub fn from(small: NonZeroI16) -> NonZeroIsize
[src]
Converts NonZeroI16
to NonZeroIsize
losslessly.
impl From<NonZeroI8> for NonZeroIsize
1.41.0[src]
impl From<NonZeroI8> for NonZeroIsize
1.41.0[src]pub fn from(small: NonZeroI8) -> NonZeroIsize
[src]
Converts NonZeroI8
to NonZeroIsize
losslessly.
impl From<NonZeroIsize> for isize
1.31.0[src]
impl From<NonZeroIsize> for isize
1.31.0[src]pub fn from(nonzero: NonZeroIsize) -> isize
[src]
Converts a NonZeroIsize
into an isize
impl From<NonZeroU8> for NonZeroIsize
1.41.0[src]
impl From<NonZeroU8> for NonZeroIsize
1.41.0[src]pub fn from(small: NonZeroU8) -> NonZeroIsize
[src]
Converts NonZeroU8
to NonZeroIsize
losslessly.
impl FromStr for NonZeroIsize
1.35.0[src]
impl FromStr for NonZeroIsize
1.35.0[src]type Err = ParseIntError
The associated error which can be returned from parsing.
pub fn from_str(
src: &str
) -> Result<NonZeroIsize, <NonZeroIsize as FromStr>::Err>
[src]
src: &str
) -> Result<NonZeroIsize, <NonZeroIsize as FromStr>::Err>
impl Hash for NonZeroIsize
[src]
impl Hash for NonZeroIsize
[src]impl LowerHex for NonZeroIsize
[src]
impl LowerHex for NonZeroIsize
[src]impl Ord for NonZeroIsize
[src]
impl Ord for NonZeroIsize
[src]impl PartialEq<NonZeroIsize> for NonZeroIsize
[src]
impl PartialEq<NonZeroIsize> for NonZeroIsize
[src]pub fn eq(&self, other: &NonZeroIsize) -> bool
[src]
pub fn ne(&self, other: &NonZeroIsize) -> bool
[src]
impl PartialOrd<NonZeroIsize> for NonZeroIsize
[src]
impl PartialOrd<NonZeroIsize> for NonZeroIsize
[src]pub fn partial_cmp(&self, other: &NonZeroIsize) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for NonZeroIsize
[src]
impl Serialize for NonZeroIsize
[src]pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl StructuralEq for NonZeroIsize
[src]
impl StructuralEq for NonZeroIsize
[src]impl StructuralPartialEq for NonZeroIsize
[src]
impl StructuralPartialEq for NonZeroIsize
[src]impl TryFrom<NonZeroI128> for NonZeroIsize
1.49.0[src]
impl TryFrom<NonZeroI128> for NonZeroIsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroI128
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroI128>>::Error>
[src]
value: NonZeroI128
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroI128>>::Error>
Attempts to convert NonZeroI128
to NonZeroIsize
.
impl TryFrom<NonZeroI32> for NonZeroIsize
1.49.0[src]
impl TryFrom<NonZeroI32> for NonZeroIsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroI32
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroI32>>::Error>
[src]
value: NonZeroI32
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroI32>>::Error>
Attempts to convert NonZeroI32
to NonZeroIsize
.
impl TryFrom<NonZeroI64> for NonZeroIsize
1.49.0[src]
impl TryFrom<NonZeroI64> for NonZeroIsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroI64
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroI64>>::Error>
[src]
value: NonZeroI64
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroI64>>::Error>
Attempts to convert NonZeroI64
to NonZeroIsize
.
impl TryFrom<NonZeroIsize> for NonZeroI16
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroI16
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroI16, <NonZeroI16 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroI16, <NonZeroI16 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroI16
.
impl TryFrom<NonZeroIsize> for NonZeroI128
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroI128
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroI128, <NonZeroI128 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroI128, <NonZeroI128 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroI128
.
impl TryFrom<NonZeroIsize> for NonZeroI64
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroI64
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroI64, <NonZeroI64 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroI64, <NonZeroI64 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroI64
.
impl TryFrom<NonZeroIsize> for NonZeroU128
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroU128
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroU128, <NonZeroU128 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroU128, <NonZeroU128 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroU128
.
impl TryFrom<NonZeroIsize> for NonZeroUsize
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroUsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroUsize, <NonZeroUsize as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroUsize, <NonZeroUsize as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroUsize
.
impl TryFrom<NonZeroIsize> for NonZeroU32
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroU32
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroU32, <NonZeroU32 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroU32, <NonZeroU32 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroU32
.
impl TryFrom<NonZeroIsize> for NonZeroU8
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroU8
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroU8, <NonZeroU8 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroU8, <NonZeroU8 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroU8
.
impl TryFrom<NonZeroIsize> for NonZeroI8
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroI8
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroI8, <NonZeroI8 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroI8, <NonZeroI8 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroI8
.
impl TryFrom<NonZeroIsize> for NonZeroU16
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroU16
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroU16, <NonZeroU16 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroU16, <NonZeroU16 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroU16
.
impl TryFrom<NonZeroIsize> for NonZeroU64
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroU64
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroU64, <NonZeroU64 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroU64, <NonZeroU64 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroU64
.
impl TryFrom<NonZeroIsize> for NonZeroI32
1.49.0[src]
impl TryFrom<NonZeroIsize> for NonZeroI32
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroIsize
) -> Result<NonZeroI32, <NonZeroI32 as TryFrom<NonZeroIsize>>::Error>
[src]
value: NonZeroIsize
) -> Result<NonZeroI32, <NonZeroI32 as TryFrom<NonZeroIsize>>::Error>
Attempts to convert NonZeroIsize
to NonZeroI32
.
impl TryFrom<NonZeroU128> for NonZeroIsize
1.49.0[src]
impl TryFrom<NonZeroU128> for NonZeroIsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroU128
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroU128>>::Error>
[src]
value: NonZeroU128
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroU128>>::Error>
Attempts to convert NonZeroU128
to NonZeroIsize
.
impl TryFrom<NonZeroU16> for NonZeroIsize
1.49.0[src]
impl TryFrom<NonZeroU16> for NonZeroIsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroU16
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroU16>>::Error>
[src]
value: NonZeroU16
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroU16>>::Error>
Attempts to convert NonZeroU16
to NonZeroIsize
.
impl TryFrom<NonZeroU32> for NonZeroIsize
1.49.0[src]
impl TryFrom<NonZeroU32> for NonZeroIsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroU32
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroU32>>::Error>
[src]
value: NonZeroU32
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroU32>>::Error>
Attempts to convert NonZeroU32
to NonZeroIsize
.
impl TryFrom<NonZeroU64> for NonZeroIsize
1.49.0[src]
impl TryFrom<NonZeroU64> for NonZeroIsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroU64
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroU64>>::Error>
[src]
value: NonZeroU64
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroU64>>::Error>
Attempts to convert NonZeroU64
to NonZeroIsize
.
impl TryFrom<NonZeroUsize> for NonZeroIsize
1.49.0[src]
impl TryFrom<NonZeroUsize> for NonZeroIsize
1.49.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroUsize
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroUsize>>::Error>
[src]
value: NonZeroUsize
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<NonZeroUsize>>::Error>
Attempts to convert NonZeroUsize
to NonZeroIsize
.
impl TryFrom<isize> for NonZeroIsize
1.46.0[src]
impl TryFrom<isize> for NonZeroIsize
1.46.0[src]type Error = TryFromIntError
The type returned in the event of a conversion error.
pub fn try_from(
value: isize
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<isize>>::Error>
[src]
value: isize
) -> Result<NonZeroIsize, <NonZeroIsize as TryFrom<isize>>::Error>
Attempts to convert isize
to NonZeroIsize
.
Auto Trait Implementations
impl RefUnwindSafe for NonZeroIsize
impl RefUnwindSafe for NonZeroIsize
impl Send for NonZeroIsize
impl Send for NonZeroIsize
impl Sync for NonZeroIsize
impl Sync for NonZeroIsize
impl Unpin for NonZeroIsize
impl Unpin for NonZeroIsize
impl UnwindSafe for NonZeroIsize
impl UnwindSafe for NonZeroIsize
Blanket Implementations
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut I
impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized,
[src]
Notable traits for &'_ mut I
impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut I
impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized,
[src]
Notable traits for &'_ mut I
impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,