pub struct i101(_);Expand description
The 101-bit signed integer type.
Implementations§
source§impl i101
impl i101
sourcepub const MIN: i101 = _
pub const MIN: i101 = _
The smallest value that can be represented by this integer type.
Examples
Basic usage:
assert_eq!(i101::MIN, i101::try_from(-1267650600228229401496703205376i128).unwrap());sourcepub const MAX: i101 = _
pub const MAX: i101 = _
The largest value that can be represented by this integer type.
Examples
Basic usage:
assert_eq!(i101::MAX, i101::try_from(1267650600228229401496703205375i128).unwrap());sourcepub const fn abs(self) -> i101
pub const fn abs(self) -> i101
Computes the absolute value of self.
Overflow behavior
The absolute value of i101::MIN cannot be represented as an i101, and attempting to calculate it will cause an overflow. This means that code in debug mode will trigger a panic on this case and optimized code will return i101::MIN without a panic.
Examples
Basic usage:
assert_eq!(i101::MAX.abs(), i101::MAX);
assert_eq!((i101::MIN + i101::try_from(1i8).unwrap()).abs(), i101::MAX);sourcepub fn from_be_bytes(bytes: [u8; 13]) -> Self
pub fn from_be_bytes(bytes: [u8; 13]) -> Self
Create a native endian integer value from its representation as a byte array in big endian.
sourcepub fn from_le_bytes(bytes: [u8; 13]) -> Self
pub fn from_le_bytes(bytes: [u8; 13]) -> Self
Create a native endian integer value from its representation as a byte array in little endian.
sourcepub fn from_ne_bytes(bytes: [u8; 13]) -> Self
pub fn from_ne_bytes(bytes: [u8; 13]) -> Self
Create a native endian integer value from its memory representation as a byte array in native endianness.
As the target platform’s native endianness is used, portable code likely
wants to use from_be_bytes or from_le_bytes, as appropriate instead.
sourcepub fn to_be_bytes(self) -> [u8; 13]
pub fn to_be_bytes(self) -> [u8; 13]
Return the memory representation of this integer as a byte array in big-endian (network) byte order.
Unused bits are undefined.
sourcepub fn to_le_bytes(self) -> [u8; 13]
pub fn to_le_bytes(self) -> [u8; 13]
Return the memory representation of this integer as a byte array in little-endian byte order.
Unused bits are undefined.
sourcepub fn to_ne_bytes(self) -> [u8; 13]
pub fn to_ne_bytes(self) -> [u8; 13]
Return the memory representation of this integer as a byte array in native byte order.
As the target platform’s native endianness is used, portable code should
use to_be_bytes or to_le_bytes, as appropriate, instead.
Unused bits are undefined.
sourcepub fn from_str_radix(src: &str, radix: u32) -> Result<i101, ParseIntError>
pub fn from_str_radix(src: &str, radix: u32) -> Result<i101, ParseIntError>
Converts a string slice in a given base to an integer.
The string is expected to be an optional + sign followed by digits. Leading and trailing whitespace represent an error. Digits are a subset of these characters, depending on radix:
0-9a-zA-Z
Panics
This function panics if radix is not in the range from 2 to 36.
Trait Implementations§
source§impl Ord for i101
impl Ord for i101
source§impl PartialEq<i101> for i101
impl PartialEq<i101> for i101
source§impl PartialOrd<i101> for i101
impl PartialOrd<i101> for i101
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more