Struct ux::u3 [] [src]

pub struct u3(_);

The 3-bit unsigned integer type.

Methods

impl u3
[src]

MAX: Self = u3(((1 as u8) << 3) - 1)

MIN: Self = u3(0)

impl u3
[src]

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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 From<u3> for u8
[src]

[src]

Performs the conversion.

impl From<u3> for u16
[src]

[src]

Performs the conversion.

impl From<u3> for u32
[src]

[src]

Performs the conversion.

impl From<u3> for u64
[src]

[src]

Performs the conversion.

impl From<u2> for u3
[src]

[src]

Performs the conversion.

impl From<u3> for u4
[src]

[src]

Performs the conversion.

impl From<u3> for u5
[src]

[src]

Performs the conversion.

impl From<u3> for u6
[src]

[src]

Performs the conversion.

impl From<u3> for u7
[src]

[src]

Performs the conversion.

impl From<u3> for u9
[src]

[src]

Performs the conversion.

impl From<u3> for u10
[src]

[src]

Performs the conversion.

impl From<u3> for u11
[src]

[src]

Performs the conversion.

impl From<u3> for u12
[src]

[src]

Performs the conversion.

impl From<u3> for u13
[src]

[src]

Performs the conversion.

impl From<u3> for u14
[src]

[src]

Performs the conversion.

impl From<u3> for u15
[src]

[src]

Performs the conversion.

impl From<u3> for u17
[src]

[src]

Performs the conversion.

impl From<u3> for u18
[src]

[src]

Performs the conversion.

impl From<u3> for u19
[src]

[src]

Performs the conversion.

impl From<u3> for u20
[src]

[src]

Performs the conversion.

impl From<u3> for u21
[src]

[src]

Performs the conversion.

impl From<u3> for u22
[src]

[src]

Performs the conversion.

impl From<u3> for u23
[src]

[src]

Performs the conversion.

impl From<u3> for u24
[src]

[src]

Performs the conversion.

impl From<u3> for u25
[src]

[src]

Performs the conversion.

impl From<u3> for u26
[src]

[src]

Performs the conversion.

impl From<u3> for u27
[src]

[src]

Performs the conversion.

impl From<u3> for u28
[src]

[src]

Performs the conversion.

impl From<u3> for u29
[src]

[src]

Performs the conversion.

impl From<u3> for u30
[src]

[src]

Performs the conversion.

impl From<u3> for u31
[src]

[src]

Performs the conversion.

impl From<u3> for u33
[src]

[src]

Performs the conversion.

impl From<u3> for u34
[src]

[src]

Performs the conversion.

impl From<u3> for u35
[src]

[src]

Performs the conversion.

impl From<u3> for u36
[src]

[src]

Performs the conversion.

impl From<u3> for u37
[src]

[src]

Performs the conversion.

impl From<u3> for u38
[src]

[src]

Performs the conversion.

impl From<u3> for u39
[src]

[src]

Performs the conversion.

impl From<u3> for u40
[src]

[src]

Performs the conversion.

impl From<u3> for u41
[src]

[src]

Performs the conversion.

impl From<u3> for u42
[src]

[src]

Performs the conversion.

impl From<u3> for u43
[src]

[src]

Performs the conversion.

impl From<u3> for u44
[src]

[src]

Performs the conversion.

impl From<u3> for u45
[src]

[src]

Performs the conversion.

impl From<u3> for u46
[src]

[src]

Performs the conversion.

impl From<u3> for u47
[src]

[src]

Performs the conversion.

impl From<u3> for u48
[src]

[src]

Performs the conversion.

impl From<u3> for u49
[src]

[src]

Performs the conversion.

impl From<u3> for u50
[src]

[src]

Performs the conversion.

impl From<u3> for u51
[src]

[src]

Performs the conversion.

impl From<u3> for u52
[src]

[src]

Performs the conversion.

impl From<u3> for u53
[src]

[src]

Performs the conversion.

impl From<u3> for u54
[src]

[src]

Performs the conversion.

impl From<u3> for u55
[src]

[src]

Performs the conversion.

impl From<u3> for u56
[src]

[src]

Performs the conversion.

impl From<u3> for u57
[src]

[src]

Performs the conversion.

impl From<u3> for u58
[src]

[src]

Performs the conversion.

impl From<u3> for u59
[src]

[src]

Performs the conversion.

impl From<u3> for u60
[src]

[src]

Performs the conversion.

impl From<u3> for u61
[src]

[src]

Performs the conversion.

impl From<u3> for u62
[src]

[src]

Performs the conversion.

impl From<u3> for u63
[src]

[src]

Performs the conversion.

impl Default for u3
[src]

[src]

Returns the "default value" for a type. Read more

impl Clone for u3
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for u3
[src]

impl Debug for u3
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for u3
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl Eq for u3
[src]

impl PartialOrd for u3
[src]

[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

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 Ord for u3
[src]

[src]

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

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Hash for u3
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

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

impl Display for u3
[src]

[src]

Formats the value using the given formatter. Read more

impl UpperHex for u3
[src]

[src]

Formats the value using the given formatter.

impl LowerHex for u3
[src]

[src]

Formats the value using the given formatter.

impl Octal for u3
[src]

[src]

Formats the value using the given formatter.

impl Binary for u3
[src]

[src]

Formats the value using the given formatter.

impl<T> Shr<T> for u3 where
    u8: Shr<T, Output = u8>, 
[src]

The resulting type after applying the >> operator.

[src]

Performs the >> operation.

impl<T> Shl<T> for u3 where
    u8: Shl<T, Output = u8>, 
[src]

The resulting type after applying the << operator.

[src]

Performs the << operation.

impl<T> ShrAssign<T> for u3 where
    u8: ShrAssign<T>, 
[src]

[src]

Performs the >>= operation.

impl<T> ShlAssign<T> for u3 where
    u8: ShlAssign<T>, 
[src]

[src]

Performs the <<= operation.

impl BitOr<u3> for u3
[src]

The resulting type after applying the | operator.

[src]

Performs the | operation.

impl<'a> BitOr<&'a u3> for u3
[src]

The resulting type after applying the | operator.

[src]

Performs the | operation.

impl<'a> BitOr<u3> for &'a u3
[src]

The resulting type after applying the | operator.

[src]

Performs the | operation.

impl<'a> BitOr<&'a u3> for &'a u3
[src]

The resulting type after applying the | operator.

[src]

Performs the | operation.

impl BitOrAssign<u3> for u3
[src]

[src]

Performs the |= operation.

impl BitXor<u3> for u3
[src]

The resulting type after applying the ^ operator.

[src]

Performs the ^ operation.

impl<'a> BitXor<&'a u3> for u3
[src]

The resulting type after applying the ^ operator.

[src]

Performs the ^ operation.

impl<'a> BitXor<u3> for &'a u3
[src]

The resulting type after applying the ^ operator.

[src]

Performs the ^ operation.

impl<'a> BitXor<&'a u3> for &'a u3
[src]

The resulting type after applying the ^ operator.

[src]

Performs the ^ operation.

impl BitXorAssign<u3> for u3
[src]

[src]

Performs the ^= operation.

impl Not for u3
[src]

The resulting type after applying the ! operator.

[src]

Performs the unary ! operation.

impl<'a> Not for &'a u3
[src]

The resulting type after applying the ! operator.

[src]

Performs the unary ! operation.

impl BitAnd<u3> for u3
[src]

The resulting type after applying the & operator.

[src]

Performs the & operation.

impl<'a> BitAnd<&'a u3> for u3
[src]

The resulting type after applying the & operator.

[src]

Performs the & operation.

impl<'a> BitAnd<u3> for &'a u3
[src]

The resulting type after applying the & operator.

[src]

Performs the & operation.

impl<'a> BitAnd<&'a u3> for &'a u3
[src]

The resulting type after applying the & operator.

[src]

Performs the & operation.

impl BitAndAssign<u3> for u3
[src]

[src]

Performs the &= operation.

impl Add<u3> for u3
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<u3> for u3
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

Auto Trait Implementations

impl Send for u3

impl Sync for u3