[]Struct lv2rs::prelude::u14

pub struct u14(_);

The 14-bit unsigned integer type.

Methods

impl u14

pub const MAX: u14

pub const MIN: u14

impl u14

pub fn min_value() -> u14

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

pub fn max_value() -> u14

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

pub fn new(value: u16) -> u14

Crates a new variable

This function mainly exists as there is currently not a better way to construct these types. May be deprecated or removed if a better way to construct these types becomes available.

Examples

Basic usage:

use ux::*;

assert_eq!(u31::new(64), u31::from(64u8));

Panic

This function will panic if value is not representable by this type

pub fn wrapping_sub(self, rhs: u14) -> u14

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

Examples

Basic usage:

use ux::*;

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));

pub fn wrapping_add(self, rhs: u14) -> u14

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

Examples

Basic usage:

use ux::*;

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));

Trait Implementations

impl<T> ShlAssign<T> for u14 where
    u16: ShlAssign<T>, 

impl Octal for u14

impl<T> Shl<T> for u14 where
    u16: Shl<T>,
    <u16 as Shl<T>>::Output == u16

type Output = u14

The resulting type after applying the << operator.

impl BitXorAssign<u14> for u14

impl<'a> Not for &'a u14

type Output = <u14 as Not>::Output

The resulting type after applying the ! operator.

impl Not for u14

type Output = u14

The resulting type after applying the ! operator.

impl UpperHex for u14

impl Copy for u14

impl LowerHex for u14

impl Ord for u14

default fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

default fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

default fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<T> ShrAssign<T> for u14 where
    u16: ShrAssign<T>, 

impl BitAnd<u14> for u14

type Output = u14

The resulting type after applying the & operator.

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the & operator.

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the & operator.

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the & operator.

impl Add<u14> for u14

type Output = u14

The resulting type after applying the + operator.

impl Clone for u14

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl BitOrAssign<u14> for u14

impl BitAndAssign<u14> for u14

impl Hash for u14

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

Feeds a slice of this type into the given [Hasher]. Read more

impl Eq for u14

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the | operator.

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the | operator.

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the | operator.

impl BitOr<u14> for u14

type Output = u14

The resulting type after applying the | operator.

impl Sub<u14> for u14

type Output = u14

The resulting type after applying the - operator.

impl PartialOrd<u14> for u14

#[must_use]
default fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
default fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
default fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
default fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

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

impl From<u6> for u14

impl From<u9> for u14

impl From<u2> for u14

impl From<u8> for u14

impl From<u10> for u14

impl From<u5> for u14

impl From<u3> for u14

impl From<u4> for u14

impl From<u13> for u14

impl From<u7> for u14

impl From<u11> for u14

impl From<u12> for u14

impl Display for u14

impl Debug for u14

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the ^ operator.

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the ^ operator.

impl BitXor<u14> for u14

type Output = u14

The resulting type after applying the ^ operator.

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

type Output = <u14 as BitOr<u14>>::Output

The resulting type after applying the ^ operator.

impl<T> Shr<T> for u14 where
    u16: Shr<T>,
    <u16 as Shr<T>>::Output == u16

type Output = u14

The resulting type after applying the >> operator.

impl Binary for u14

impl Default for u14

impl PartialEq<u14> for u14

#[must_use]
default fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

Auto Trait Implementations

impl Send for u14

impl Sync for u14

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]