Struct readable::Unsigned

source ·
pub struct Unsigned(_, _);
Expand description

Human readable unsigned integer.

Creation

For u8, u16, u32, u64, usize or any NonZeroU8 variant:

f32 or f64 inputs will work, but:

For i8 and other signed integers:

Cloning

Copy is available.

The actual string used internally is not a String, but a 26 byte array buffer, literally: [u8; 26].

The documentation will still refer to the inner buffer as a String. Anything returned will also be a String.

let a = Unsigned::from(100_000_u64);

// Copy 'a', use 'b'.
let b = a;
assert!(b == 100_000_u64);

// We can still use 'a'
assert!(a == 100_000_u64);

Float Errors

To disable checks for these, (you are sure you don’t have NaN’s), enable the ignore_nan_inf feature flag.

Math

These operators are overloaded. They will always output a new Self:

  • Add +
  • Sub -
  • Div /
  • Mul *
  • Rem %

They can either be:

  • Combined with another Self: Unsigned::from(1) + Unsigned::from(1)
  • Or with the inner number itself: Unsigned::from(1) + 1

They also have the same panic!() behavior on overflow as the normal ones, because internally, it is just calling .inner() $OPERATOR $NUMBER.

assert!(Unsigned::from(10_u64) + 10 == Unsigned::from(20_u64));
assert!(Unsigned::from(10_u64) - 10 == Unsigned::from(0_u64));
assert!(Unsigned::from(10_u64) / 10 == Unsigned::from(1_u64));
assert!(Unsigned::from(10_u64) * 10 == Unsigned::from(100_u64));
assert!(Unsigned::from(10_u64) % 10 == Unsigned::from(0_u64));

Overflow example:

let n = Unsigned::from(u64::MAX) + u64::MAX;

Examples

// From unsigned integers.
assert!(Unsigned::from(100_u8)        == "100");
assert!(Unsigned::from(10_000_u16)    == "10,000");
assert!(Unsigned::from(100_000_u32)   == "100,000");
assert!(Unsigned::from(1_000_000_u64) == "1,000,000");

// From floats.
assert!(Unsigned::from(-1.0)        == "0");
assert!(Unsigned::from(1_000.123)   == "1,000");
assert!(Unsigned::from(100_000.123) == "100,000");
assert!(Unsigned::from(100_000.123) == "100,000");
assert!(Unsigned::from(f32::NAN)    == "???");

// From signed integers.
assert!(Unsigned::try_from(100_i8)         == Ok(Unsigned::from(100_u8)));
assert!(Unsigned::try_from(-100_i8)        == Err(Unsigned::unknown()));
assert!(Unsigned::try_from(1_000_000_i64)  == Ok(Unsigned::from(1_000_000_u32)));
assert!(Unsigned::try_from(-1_000_000_i64) == Err(Unsigned::unknown()));

Implementations§

source§

impl Unsigned

source

pub fn as_str(&self) -> &str

Return a borrowed str without consuming Self.

source

pub fn as_bytes(&self) -> &[u8]

Returns the valid byte slice of the inner String

These bytes can always safely be used for std::str::from_utf8_unchecked.

source

pub fn to_vec(&self) -> Vec<u8>

Return the bytes of the inner String as a Vec

source

pub fn into_vec(self) -> Vec<u8>

Return the bytes of the inner String as a Vec, consuming Self

source

pub const fn inner(&self) -> u64

Returns the inner number.

source

pub fn into_string(self) -> String

Consumes Self, returning the inner String.

source

pub fn into_raw(self) -> (u64, String)

Consumes Self, returning the inner parts.

source

pub fn head(&self, len: usize) -> &str

Return the first len bytes of this str.

This will return the full str if the len is longer than the actual inner str.

Since all readable types happen to only contain ASCII characters, all char’s are equal to 1 byte.

let date = Date::from_str("2021-12-11").unwrap();

assert!(date.head(5) == "2021-");
source

pub fn head_dot(&self, len: usize) -> String

Same as Self::head but returns a String ending with ...

This will return the full string without ... if the len is longer than the actual inner str.

let date = Date::from_str("2021-12-11").unwrap();

assert!(date.head_dot(4) == "2021...");
source

pub fn tail(&self, len: usize) -> &str

Return the last len bytes of this str.

This will return the full str if the len is longer than the actual inner str.

Since all readable types happen to only contain ASCII characters, all char’s are equal to 1 byte.

let date = Date::from_str("2021-12-11").unwrap();

assert!(date.tail(5) == "12-11");
source

pub fn tail_dot(&self, len: usize) -> String

Same as Self::tail but returns a String starting with ...

This will return the full string without ... if the len is longer than the actual inner str.

let date = Date::from_str("2021-12-11").unwrap();

assert!(date.tail_dot(5) == "...12-11");
source

pub fn head_tail(&self, head: usize, tail: usize) -> String

Return the first head bytes and last tail bytes of this string separated with ....

Since all readable types happen to only contain ASCII characters, all char’s are equal to 1 byte.

let date = Date::from_str("2021-12-11").unwrap();

assert!(date.head_tail(3, 2) == "202...11");
assert!(date.head_tail(3, 3) == "202...-11");
assert!(date.head_tail(3, 5) == "202...12-11");
source

pub const fn len(&self) -> usize

The length of the inner String

source

pub const fn is_empty(&self) -> bool

If the inner String is empty or not

source

pub const fn to_buf(&self) -> [u8; 26]

Return the full inner buffer that represents the String.

These are guaranteed to be valid UTF-8 bytes.

Not all bytes are necessarily used, however. To find the valid portion of the string, use Self::len.

let u           = Unsigned::from(123_u8);
let buffer      = u.to_buf();
let valid_bytes = &buffer[0..u.len()];

// SAFETY: These bytes are always be valid UTF-8.
unsafe {
    let specified = std::str::from_utf8_unchecked(&valid_bytes);
    let all_bytes = std::str::from_utf8_unchecked(&buffer);

    // Bunch of trailing `\0\0\0`'s at the end.
    assert!(all_bytes != "123");
    assert!(specified == "123");
}
source

pub const fn into_buf(self) -> [u8; 26]

Same as Self::to_buf but consumes self.

source

pub const fn as_buf(&self) -> &[u8; 26]

Same as Self::to_buf but returns a borrowed array.

source

pub const fn to_buf_parts(&self) -> ([u8; 26], usize)

Same as Self::to_buf but returns the length as well.

source

pub const fn into_buf_parts(self) -> ([u8; 26], usize)

Same as Self::into_buf but returns the length as well.

source

pub const fn zero() -> Self

assert!(Unsigned::zero() == 0);
source

pub const fn unknown() -> Self

assert!(Unsigned::unknown() == UNKNOWN);

Trait Implementations§

source§

impl Add<&Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the + operator.
source§

fn add(self, other: &Unsigned) -> Self

Performs the + operation. Read more
source§

impl Add<&Unsigned> for u64

§

type Output = u64

The resulting type after applying the + operator.
source§

fn add(self, other: &Unsigned) -> Self

Performs the + operation. Read more
source§

impl Add<&u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the + operator.
source§

fn add(self, other: &u64) -> Self

Performs the + operation. Read more
source§

impl Add<Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the + operator.
source§

fn add(self, other: Unsigned) -> Self

Performs the + operation. Read more
source§

impl Add<Unsigned> for u64

§

type Output = u64

The resulting type after applying the + operator.
source§

fn add(self, other: Unsigned) -> Self

Performs the + operation. Read more
source§

impl Add<u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the + operator.
source§

fn add(self, other: u64) -> Self

Performs the + operation. Read more
source§

impl<'__de> BorrowDecode<'__de> for Unsigned

source§

fn borrow_decode<__D: BorrowDecoder<'__de>>( decoder: &mut __D ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
source§

impl Clone for Unsigned

source§

fn clone(&self) -> Unsigned

Returns a copy 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 Unsigned

source§

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

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

impl Decode for Unsigned

source§

fn decode<__D: Decoder>(decoder: &mut __D) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
source§

impl Default for Unsigned

source§

fn default() -> Self

Calls Self::zero

source§

impl<'de> Deserialize<'de> for Unsigned

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 Unsigned

source§

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

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

impl Div<&Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the / operator.
source§

fn div(self, other: &Unsigned) -> Self

Performs the / operation. Read more
source§

impl Div<&Unsigned> for u64

§

type Output = u64

The resulting type after applying the / operator.
source§

fn div(self, other: &Unsigned) -> Self

Performs the / operation. Read more
source§

impl Div<&u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the / operator.
source§

fn div(self, other: &u64) -> Self

Performs the / operation. Read more
source§

impl Div<Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the / operator.
source§

fn div(self, other: Unsigned) -> Self

Performs the / operation. Read more
source§

impl Div<Unsigned> for u64

§

type Output = u64

The resulting type after applying the / operator.
source§

fn div(self, other: Unsigned) -> Self

Performs the / operation. Read more
source§

impl Div<u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the / operator.
source§

fn div(self, other: u64) -> Self

Performs the / operation. Read more
source§

impl Encode for Unsigned

source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
source§

impl From<&NonZeroU16> for Unsigned

source§

fn from(uint: &NonZeroU16) -> Self

Converts to this type from the input type.
source§

impl From<&NonZeroU32> for Unsigned

source§

fn from(uint: &NonZeroU32) -> Self

Converts to this type from the input type.
source§

impl From<&NonZeroU64> for Unsigned

source§

fn from(uint: &NonZeroU64) -> Self

Converts to this type from the input type.
source§

impl From<&NonZeroU8> for Unsigned

source§

fn from(uint: &NonZeroU8) -> Self

Converts to this type from the input type.
source§

impl From<&NonZeroUsize> for Unsigned

source§

fn from(uint: &NonZeroUsize) -> Self

Converts to this type from the input type.
source§

impl From<NonZeroU16> for Unsigned

source§

fn from(uint: NonZeroU16) -> Self

Converts to this type from the input type.
source§

impl From<NonZeroU32> for Unsigned

source§

fn from(uint: NonZeroU32) -> Self

Converts to this type from the input type.
source§

impl From<NonZeroU64> for Unsigned

source§

fn from(uint: NonZeroU64) -> Self

Converts to this type from the input type.
source§

impl From<NonZeroU8> for Unsigned

source§

fn from(uint: NonZeroU8) -> Self

Converts to this type from the input type.
source§

impl From<NonZeroUsize> for Unsigned

source§

fn from(uint: NonZeroUsize) -> Self

Converts to this type from the input type.
source§

impl From<f32> for Unsigned

This will silently return Self::unknown if the input float is NAN, INFINITY, etc.

Self::zero will be returned on negative floats.

source§

fn from(float: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Unsigned

This will silently return Self::unknown if the input float is NAN, INFINITY, etc.

Self::zero will be returned on negative floats.

source§

fn from(float: f64) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Unsigned

source§

fn from(uint: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Unsigned

source§

fn from(uint: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Unsigned

source§

fn from(uint: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Unsigned

source§

fn from(uint: u8) -> Self

Converts to this type from the input type.
source§

impl From<usize> for Unsigned

source§

fn from(uint: usize) -> Self

Converts to this type from the input type.
source§

impl Hash for Unsigned

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Mul<&Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the * operator.
source§

fn mul(self, other: &Unsigned) -> Self

Performs the * operation. Read more
source§

impl Mul<&Unsigned> for u64

§

type Output = u64

The resulting type after applying the * operator.
source§

fn mul(self, other: &Unsigned) -> Self

Performs the * operation. Read more
source§

impl Mul<&u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the * operator.
source§

fn mul(self, other: &u64) -> Self

Performs the * operation. Read more
source§

impl Mul<Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the * operator.
source§

fn mul(self, other: Unsigned) -> Self

Performs the * operation. Read more
source§

impl Mul<Unsigned> for u64

§

type Output = u64

The resulting type after applying the * operator.
source§

fn mul(self, other: Unsigned) -> Self

Performs the * operation. Read more
source§

impl Mul<u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the * operator.
source§

fn mul(self, other: u64) -> Self

Performs the * operation. Read more
source§

impl Ord for Unsigned

source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · source§

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

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

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

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<&Unsigned> for str

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&Unsigned> for u64

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&str> for Unsigned

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Unsigned> for Unsigned

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Unsigned> for str

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Unsigned> for u64

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<str> for Unsigned

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<u64> for &Unsigned

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<u64> for Unsigned

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<&Unsigned> for str

source§

fn partial_cmp(&self, other: &&Unsigned) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<&Unsigned> for u64

source§

fn partial_cmp(&self, other: &&Unsigned) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<&str> for Unsigned

source§

fn partial_cmp(&self, other: &&str) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Unsigned> for Unsigned

source§

fn partial_cmp(&self, other: &Unsigned) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Unsigned> for str

source§

fn partial_cmp(&self, other: &Unsigned) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Unsigned> for u64

source§

fn partial_cmp(&self, other: &Unsigned) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<str> for Unsigned

source§

fn partial_cmp(&self, other: &str) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<u64> for &Unsigned

source§

fn partial_cmp(&self, other: &u64) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<u64> for Unsigned

source§

fn partial_cmp(&self, other: &u64) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Rem<&Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the % operator.
source§

fn rem(self, other: &Unsigned) -> Self

Performs the % operation. Read more
source§

impl Rem<&Unsigned> for u64

§

type Output = u64

The resulting type after applying the % operator.
source§

fn rem(self, other: &Unsigned) -> Self

Performs the % operation. Read more
source§

impl Rem<&u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the % operator.
source§

fn rem(self, other: &u64) -> Self

Performs the % operation. Read more
source§

impl Rem<Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl Rem<Unsigned> for u64

§

type Output = u64

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl Rem<u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl Serialize for Unsigned

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 Sub<&Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the - operator.
source§

fn sub(self, other: &Unsigned) -> Self

Performs the - operation. Read more
source§

impl Sub<&Unsigned> for u64

§

type Output = u64

The resulting type after applying the - operator.
source§

fn sub(self, other: &Unsigned) -> Self

Performs the - operation. Read more
source§

impl Sub<&u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the - operator.
source§

fn sub(self, other: &u64) -> Self

Performs the - operation. Read more
source§

impl Sub<Unsigned> for Unsigned

§

type Output = Unsigned

The resulting type after applying the - operator.
source§

fn sub(self, other: Unsigned) -> Self

Performs the - operation. Read more
source§

impl Sub<Unsigned> for u64

§

type Output = u64

The resulting type after applying the - operator.
source§

fn sub(self, other: Unsigned) -> Self

Performs the - operation. Read more
source§

impl Sub<u64> for Unsigned

§

type Output = Unsigned

The resulting type after applying the - operator.
source§

fn sub(self, other: u64) -> Self

Performs the - operation. Read more
source§

impl TryFrom<&NonZeroI16> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: &NonZeroI16) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<&NonZeroI32> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: &NonZeroI32) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<&NonZeroI64> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: &NonZeroI64) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<&NonZeroI8> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: &NonZeroI8) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<&NonZeroIsize> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: &NonZeroIsize) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<NonZeroI16> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: NonZeroI16) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<NonZeroI32> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: NonZeroI32) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<NonZeroI64> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: NonZeroI64) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<NonZeroI8> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: NonZeroI8) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<NonZeroIsize> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: NonZeroIsize) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<i16> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: i16) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<i32> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: i32) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<i64> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: i64) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<i8> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: i8) -> Result<Self, Self>

Performs the conversion.
source§

impl TryFrom<isize> for Unsigned

This will return Self::unknown wrapped in Result::Err if the conversion fails.

§

type Error = Unsigned

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

fn try_from(num: isize) -> Result<Self, Self>

Performs the conversion.
source§

impl Copy for Unsigned

source§

impl Eq for Unsigned

source§

impl StructuralEq for Unsigned

source§

impl StructuralPartialEq for Unsigned

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> ToCompactString for Twhere T: Display,

source§

fn to_compact_string(&self) -> CompactString

Converts the given value to a CompactString. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

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 Twhere U: TryFrom<T>,

§

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 Twhere T: for<'de> Deserialize<'de>,