Struct u18

Source
pub struct u18(/* private fields */);
Expand description

The 18-bit unsigned integer type.

Implementations§

Source§

impl u18

Source

pub const MAX: Self

Source

pub const MIN: Self

Source§

impl u18

Source

pub const fn min_value() -> Self

Returns the smallest value that can be represented by this integer type.

Source

pub const fn max_value() -> Self

Returns the largest value that can be represented by this integer type.

Source

pub fn new(value: u32) -> Self

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Wrapping (modular) subtraction. Computes self - other, wrapping around at the boundary of the type.

§Examples

Basic usage:

use num_x::*;

assert_eq!(i5::MIN.wrapping_sub(i5::new(1)), i5::MAX);

assert_eq!(i5::new(-10).wrapping_sub(i5::new(5)), i5::new(-15));
assert_eq!(i5::new(-15).wrapping_sub(i5::new(5)), i5::new(12));
Source

pub const fn wrapping_add(self, rhs: Self) -> Self

Wrapping (modular) addition. Computes self + other, wrapping around at the boundary of the type.

§Examples

Basic usage:

use num_x::*;

assert_eq!(i5::MAX.wrapping_add(i5::new(1)), i5::MIN);

assert_eq!(i5::new(10).wrapping_add(i5::new(5)), i5::new(15));
assert_eq!(i5::new(15).wrapping_add(i5::new(5)), i5::new(-12));
Source

pub const fn capacity(self) -> u32

Source

pub const fn rotate_left(self, n: u32) -> Self

Source

pub const fn rotate_right(self, n: u32) -> Self

Source

pub const fn count_ones(self) -> u32

Source

pub const fn count_zeros(self) -> u32

Source

pub const fn leading_zeros(self) -> u32

Source

pub const fn trailing_zeros(self) -> u32

Source

pub const fn reverse_bits(self) -> Self

Source

pub const fn is_power_of_two(self) -> bool

Trait Implementations§

Source§

impl Add for u18

Source§

type Output = u18

The resulting type after applying the + operator.
Source§

fn add(self, other: u18) -> Self::Output

Performs the + operation. Read more
Source§

impl Binary for u18

Source§

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

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

impl<'a> BitAnd<&'a u18> for u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &'a u18) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a> BitAnd<u18> for &'a u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl<'a> BitAnd for &'a u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &'a u18) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAnd for u18

Source§

type Output = u18

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitAndAssign for u18

Source§

fn bitand_assign(&mut self, other: Self)

Performs the &= operation. Read more
Source§

impl<'a> BitOr<&'a u18> for u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &'a u18) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a> BitOr<u18> for &'a u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl<'a> BitOr for &'a u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &'a u18) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOr for u18

Source§

type Output = u18

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitOrAssign for u18

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl<'a> BitXor<&'a u18> for u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &'a u18) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a> BitXor<u18> for &'a u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl<'a> BitXor for &'a u18

Source§

type Output = <u18 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &'a u18) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXor for u18

Source§

type Output = u18

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl BitXorAssign for u18

Source§

fn bitxor_assign(&mut self, other: Self)

Performs the ^= operation. Read more
Source§

impl Clone for u18

Source§

fn clone(&self) -> u18

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 u18

Source§

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

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

impl Default for u18

Source§

fn default() -> u18

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

impl Display for u18

Source§

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

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

impl From<u10> for u18

Source§

fn from(x: u10) -> u18

Converts to this type from the input type.
Source§

impl From<u11> for u18

Source§

fn from(x: u11) -> u18

Converts to this type from the input type.
Source§

impl From<u12> for u18

Source§

fn from(x: u12) -> u18

Converts to this type from the input type.
Source§

impl From<u13> for u18

Source§

fn from(x: u13) -> u18

Converts to this type from the input type.
Source§

impl From<u14> for u18

Source§

fn from(x: u14) -> u18

Converts to this type from the input type.
Source§

impl From<u15> for u18

Source§

fn from(x: u15) -> u18

Converts to this type from the input type.
Source§

impl From<u16> for u18

Source§

fn from(x: u16) -> u18

Converts to this type from the input type.
Source§

impl From<u17> for u18

Source§

fn from(x: u17) -> u18

Converts to this type from the input type.
Source§

impl From<u18> for u19

Source§

fn from(x: u18) -> u19

Converts to this type from the input type.
Source§

impl From<u18> for u20

Source§

fn from(x: u18) -> u20

Converts to this type from the input type.
Source§

impl From<u18> for u21

Source§

fn from(x: u18) -> u21

Converts to this type from the input type.
Source§

impl From<u18> for u22

Source§

fn from(x: u18) -> u22

Converts to this type from the input type.
Source§

impl From<u18> for u23

Source§

fn from(x: u18) -> u23

Converts to this type from the input type.
Source§

impl From<u18> for u24

Source§

fn from(x: u18) -> u24

Converts to this type from the input type.
Source§

impl From<u18> for u25

Source§

fn from(x: u18) -> u25

Converts to this type from the input type.
Source§

impl From<u18> for u26

Source§

fn from(x: u18) -> u26

Converts to this type from the input type.
Source§

impl From<u18> for u27

Source§

fn from(x: u18) -> u27

Converts to this type from the input type.
Source§

impl From<u18> for u28

Source§

fn from(x: u18) -> u28

Converts to this type from the input type.
Source§

impl From<u18> for u29

Source§

fn from(x: u18) -> u29

Converts to this type from the input type.
Source§

impl From<u18> for u30

Source§

fn from(x: u18) -> u30

Converts to this type from the input type.
Source§

impl From<u18> for u31

Source§

fn from(x: u18) -> u31

Converts to this type from the input type.
Source§

impl From<u18> for u32

Source§

fn from(x: u18) -> u32

Converts to this type from the input type.
Source§

impl From<u18> for u33

Source§

fn from(x: u18) -> u33

Converts to this type from the input type.
Source§

impl From<u18> for u34

Source§

fn from(x: u18) -> u34

Converts to this type from the input type.
Source§

impl From<u18> for u35

Source§

fn from(x: u18) -> u35

Converts to this type from the input type.
Source§

impl From<u18> for u36

Source§

fn from(x: u18) -> u36

Converts to this type from the input type.
Source§

impl From<u18> for u37

Source§

fn from(x: u18) -> u37

Converts to this type from the input type.
Source§

impl From<u18> for u38

Source§

fn from(x: u18) -> u38

Converts to this type from the input type.
Source§

impl From<u18> for u39

Source§

fn from(x: u18) -> u39

Converts to this type from the input type.
Source§

impl From<u18> for u40

Source§

fn from(x: u18) -> u40

Converts to this type from the input type.
Source§

impl From<u18> for u41

Source§

fn from(x: u18) -> u41

Converts to this type from the input type.
Source§

impl From<u18> for u42

Source§

fn from(x: u18) -> u42

Converts to this type from the input type.
Source§

impl From<u18> for u43

Source§

fn from(x: u18) -> u43

Converts to this type from the input type.
Source§

impl From<u18> for u44

Source§

fn from(x: u18) -> u44

Converts to this type from the input type.
Source§

impl From<u18> for u45

Source§

fn from(x: u18) -> u45

Converts to this type from the input type.
Source§

impl From<u18> for u46

Source§

fn from(x: u18) -> u46

Converts to this type from the input type.
Source§

impl From<u18> for u47

Source§

fn from(x: u18) -> u47

Converts to this type from the input type.
Source§

impl From<u18> for u48

Source§

fn from(x: u18) -> u48

Converts to this type from the input type.
Source§

impl From<u18> for u49

Source§

fn from(x: u18) -> u49

Converts to this type from the input type.
Source§

impl From<u18> for u50

Source§

fn from(x: u18) -> u50

Converts to this type from the input type.
Source§

impl From<u18> for u51

Source§

fn from(x: u18) -> u51

Converts to this type from the input type.
Source§

impl From<u18> for u52

Source§

fn from(x: u18) -> u52

Converts to this type from the input type.
Source§

impl From<u18> for u53

Source§

fn from(x: u18) -> u53

Converts to this type from the input type.
Source§

impl From<u18> for u54

Source§

fn from(x: u18) -> u54

Converts to this type from the input type.
Source§

impl From<u18> for u55

Source§

fn from(x: u18) -> u55

Converts to this type from the input type.
Source§

impl From<u18> for u56

Source§

fn from(x: u18) -> u56

Converts to this type from the input type.
Source§

impl From<u18> for u57

Source§

fn from(x: u18) -> u57

Converts to this type from the input type.
Source§

impl From<u18> for u58

Source§

fn from(x: u18) -> u58

Converts to this type from the input type.
Source§

impl From<u18> for u59

Source§

fn from(x: u18) -> u59

Converts to this type from the input type.
Source§

impl From<u18> for u60

Source§

fn from(x: u18) -> u60

Converts to this type from the input type.
Source§

impl From<u18> for u61

Source§

fn from(x: u18) -> u61

Converts to this type from the input type.
Source§

impl From<u18> for u62

Source§

fn from(x: u18) -> u62

Converts to this type from the input type.
Source§

impl From<u18> for u63

Source§

fn from(x: u18) -> u63

Converts to this type from the input type.
Source§

impl From<u18> for u64

Source§

fn from(x: u18) -> u64

Converts to this type from the input type.
Source§

impl From<u18> for usize

Source§

fn from(x: u18) -> usize

Converts to this type from the input type.
Source§

impl From<u2> for u18

Source§

fn from(x: u2) -> u18

Converts to this type from the input type.
Source§

impl From<u3> for u18

Source§

fn from(x: u3) -> u18

Converts to this type from the input type.
Source§

impl From<u4> for u18

Source§

fn from(x: u4) -> u18

Converts to this type from the input type.
Source§

impl From<u5> for u18

Source§

fn from(x: u5) -> u18

Converts to this type from the input type.
Source§

impl From<u6> for u18

Source§

fn from(x: u6) -> u18

Converts to this type from the input type.
Source§

impl From<u7> for u18

Source§

fn from(x: u7) -> u18

Converts to this type from the input type.
Source§

impl From<u8> for u18

Source§

fn from(x: u8) -> u18

Converts to this type from the input type.
Source§

impl From<u9> for u18

Source§

fn from(x: u9) -> u18

Converts to this type from the input type.
Source§

impl Hash for u18

Source§

fn hash<H: Hasher>(&self, h: &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 LowerHex for u18

Source§

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

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

impl<'a> Not for &'a u18

Source§

type Output = <u18 as Not>::Output

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Not for u18

Source§

type Output = u18

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Octal for u18

Source§

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

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

impl Ord for u18

Source§

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

This method returns an Ordering between self and other. 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
1.50.0 · Source§

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

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

impl PartialEq for u18

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 u18

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<T> Shl<T> for u18
where u32: Shl<T, Output = u32>,

Source§

type Output = u18

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

fn shl(self, rhs: T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T> ShlAssign<T> for u18
where u32: ShlAssign<T>,

Source§

fn shl_assign(&mut self, rhs: T)

Performs the <<= operation. Read more
Source§

impl<T> Shr<T> for u18
where u32: Shr<T, Output = u32>,

Source§

type Output = u18

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

fn shr(self, rhs: T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T> ShrAssign<T> for u18
where u32: ShrAssign<T>,

Source§

fn shr_assign(&mut self, rhs: T)

Performs the >>= operation. Read more
Source§

impl Sub for u18

Source§

type Output = u18

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl UpperHex for u18

Source§

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

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

impl Copy for u18

Source§

impl Eq for u18

Auto Trait Implementations§

§

impl Freeze for u18

§

impl RefUnwindSafe for u18

§

impl Send for u18

§

impl Sync for u18

§

impl Unpin for u18

§

impl UnwindSafe for u18

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.