Struct U200

Source
pub struct U200 { /* private fields */ }
Expand description

200-bit unsigned integer represented as little-endian byte order.

use un_prim::*;

let x: U200 = 100u8.into();
assert_eq!(100u8, x.into());

Implementations§

Source§

impl U200

Source

pub fn to_str_radix(&self, radix: u32) -> String

convert this type into radix string.

Source

pub fn from_str_radix(s: &str, radix: u32) -> Result<Self, String>

Convert string into this type by given radix.

Source§

impl U200

Source

pub const SIZE: usize = 25usize

Bytes size of this type.

Source

pub const BITS: u32 = 200u32

Bit size of this type.

Source

pub const MIN: U200

Minimum value of this type.

Source

pub const MAX: U200

Maximum value of this type.

Source

pub fn zero() -> Self

Return zero representation of this types.

Source

pub fn one() -> Self

Return one representation of this types.

Source

pub fn is_zero(&self) -> bool

Return true if this is zero.

Source

pub fn is_one(&self) -> bool

Return true if this is one.

Source

pub fn from_le_bytes(bytes: [u8; 25]) -> Self

Create this type from little endian bytes.

Source

pub fn from_be_bytes(bytes: [u8; 25]) -> Self

Create this type from big endian bytes.

Source

pub fn to_le_bytes(&self) -> [u8; 25]

Return the little endian representation of this type.

Source

pub fn to_be_bytes(&self) -> [u8; 25]

Return the big endian representation of this type.

Source

pub fn to_le(&self) -> Self

Convert this type to little endian.

Source

pub fn to_be(&self) -> Self

Convert this type to big endian.

Source

pub fn leading_zeros(&self) -> u32

Return count of leading zeros.

Source

pub fn trailing_zeros(&self) -> u32

Return count of trailing zeros.

Source

pub fn leading_ones(&self) -> u32

Return count of leading ones.

Source

pub fn trailing_ones(&self) -> u32

Return count of trailing ones.

Source

pub fn overflowing_add(&self, other: Self) -> (Self, bool)

Add two number and return the sum along with the carry.

Source

pub fn overflowing_sub(&self, other: Self) -> (Self, bool)

Subtract two number and return the sum along with the borrow.

Source

pub fn overflowing_mul(&self, other: Self) -> (Self, bool)

Return product of two number after multiplication and bool indicating overflow.

Source

pub fn div_rem(&self, rhs: Self) -> (Self, Self)

Divide two numbers and return tuple of the quotient and remainder.

Source

pub fn overflowing_shl(&self, n: u32) -> (Self, bool)

Shift left and return the result along with boolean indicating overflow.

Source

pub fn overflowing_shr(&self, n: u32) -> (Self, bool)

Shift right and return the result along with boolean indicating overflow.

Trait Implementations§

Source§

impl Add for U200

Source§

type Output = U200

The resulting type after applying the + operator.
Source§

fn add(self, other: U200) -> U200

Performs the + operation. Read more
Source§

impl AddAssign for U200

Source§

fn add_assign(&mut self, other: U200)

Performs the += operation. Read more
Source§

impl Binary for U200

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl BitAnd for U200

Source§

type Output = U200

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAndAssign for U200

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl BitOr for U200

Source§

type Output = U200

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOrAssign for U200

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl BitXor for U200

Source§

type Output = U200

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXorAssign for U200

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl Clone for U200

Source§

fn clone(&self) -> U200

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for U200

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for U200

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for U200

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for U200

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div for U200

Source§

type Output = U200

The resulting type after applying the / operator.
Source§

fn div(self, other: U200) -> U200

Performs the / operation. Read more
Source§

impl DivAssign for U200

Source§

fn div_assign(&mut self, other: U200)

Performs the /= operation. Read more
Source§

impl From<U200> for i128

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for i16

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for i32

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for i64

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for i8

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for isize

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for u128

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for u16

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for u32

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for u64

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for u8

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<U200> for usize

Source§

fn from(x: U200) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for U200

Source§

fn from(x: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for U200

Source§

fn from(x: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for U200

Source§

fn from(x: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for U200

Source§

fn from(x: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for U200

Source§

fn from(x: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for U200

Source§

fn from(x: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for U200

Source§

fn from(x: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for U200

Source§

fn from(x: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for U200

Source§

fn from(x: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for U200

Source§

fn from(x: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for U200

Source§

fn from(x: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for U200

Source§

fn from(x: usize) -> Self

Converts to this type from the input type.
Source§

impl FromStr for U200

Source§

type Err = String

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Mul for U200

Source§

type Output = U200

The resulting type after applying the * operator.
Source§

fn mul(self, other: U200) -> U200

Performs the * operation. Read more
Source§

impl MulAssign for U200

Source§

fn mul_assign(&mut self, other: U200)

Performs the *= operation. Read more
Source§

impl Not for U200

Source§

type Output = U200

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Octal for U200

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Ord for U200

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
Source§

impl PartialEq for U200

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for U200

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem for U200

Source§

type Output = U200

The resulting type after applying the % operator.
Source§

fn rem(self, other: U200) -> Self

Performs the % operation. Read more
Source§

impl RemAssign for U200

Source§

fn rem_assign(&mut self, other: U200)

Performs the %= operation. Read more
Source§

impl Serialize for U200

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Shl<u32> for U200

Source§

type Output = U200

The resulting type after applying the << operator.
Source§

fn shl(self, n: u32) -> Self::Output

Performs the << operation. Read more
Source§

impl ShlAssign<u32> for U200

Source§

fn shl_assign(&mut self, n: u32)

Performs the <<= operation. Read more
Source§

impl Shr<u32> for U200

Source§

type Output = U200

The resulting type after applying the >> operator.
Source§

fn shr(self, n: u32) -> Self::Output

Performs the >> operation. Read more
Source§

impl ShrAssign<u32> for U200

Source§

fn shr_assign(&mut self, n: u32)

Performs the >>= operation. Read more
Source§

impl Sub for U200

Source§

type Output = U200

The resulting type after applying the - operator.
Source§

fn sub(self, other: U200) -> U200

Performs the - operation. Read more
Source§

impl SubAssign for U200

Source§

fn sub_assign(&mut self, other: U200)

Performs the -= operation. Read more
Source§

impl Copy for U200

Source§

impl Eq for U200

Auto Trait Implementations§

§

impl Freeze for U200

§

impl RefUnwindSafe for U200

§

impl Send for U200

§

impl Sync for U200

§

impl Unpin for U200

§

impl UnwindSafe for U200

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,