[−]Struct lv2rs::prelude::u4
The 4-bit unsigned integer type.
Methods
impl u4
impl u4
pub fn min_value() -> u4
Returns the smallest value that can be represented by this integer type.
pub fn max_value() -> u4
Returns the largest value that can be represented by this integer type.
pub fn new(value: u8) -> u4
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: u4) -> u4
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: u4) -> u4
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 Copy for u4
impl Ord for u4
fn cmp(&self, other: &u4) -> Ordering
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl Clone for u4
fn clone(&self) -> u4
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> BitAnd<&'a u4> for u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the &
operator.
fn bitand(self, rhs: &'a u4) -> <u4 as BitAnd<&'a u4>>::Output
impl<'a> BitAnd<&'a u4> for &'a u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the &
operator.
fn bitand(self, rhs: &'a u4) -> <&'a u4 as BitAnd<&'a u4>>::Output
impl<'a> BitAnd<u4> for &'a u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the &
operator.
fn bitand(self, rhs: u4) -> <&'a u4 as BitAnd<u4>>::Output
impl BitAnd<u4> for u4
type Output = u4
The resulting type after applying the &
operator.
fn bitand(self, rhs: u4) -> <u4 as BitAnd<u4>>::Output
impl BitOrAssign<u4> for u4
fn bitor_assign(&mut self, other: u4)
impl<T> ShrAssign<T> for u4 where
u8: ShrAssign<T>,
u8: ShrAssign<T>,
fn shr_assign(&mut self, rhs: T)
impl BitAndAssign<u4> for u4
fn bitand_assign(&mut self, other: u4)
impl Binary for u4
impl Hash for u4
fn hash<H>(&self, h: &mut H) where
H: Hasher,
H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Add<u4> for u4
impl UpperHex for u4
impl<'a> BitOr<u4> for &'a u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the |
operator.
fn bitor(self, rhs: u4) -> <&'a u4 as BitOr<u4>>::Output
impl<'a> BitOr<&'a u4> for &'a u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the |
operator.
fn bitor(self, rhs: &'a u4) -> <&'a u4 as BitOr<&'a u4>>::Output
impl<'a> BitOr<&'a u4> for u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the |
operator.
fn bitor(self, rhs: &'a u4) -> <u4 as BitOr<&'a u4>>::Output
impl BitOr<u4> for u4
type Output = u4
The resulting type after applying the |
operator.
fn bitor(self, rhs: u4) -> <u4 as BitOr<u4>>::Output
impl From<u2> for u4
impl From<u4> for u14
impl From<u4> for u7
impl From<u3> for u4
impl PartialOrd<u4> for u4
fn partial_cmp(&self, other: &u4) -> Option<Ordering>
#[must_use]
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]
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]
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]
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 Eq for u4
impl Debug for u4
impl Sub<u4> for u4
impl<'a> BitXor<&'a u4> for u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: &'a u4) -> <u4 as BitXor<&'a u4>>::Output
impl BitXor<u4> for u4
type Output = u4
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: u4) -> <u4 as BitXor<u4>>::Output
impl<'a> BitXor<u4> for &'a u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: u4) -> <&'a u4 as BitXor<u4>>::Output
impl<'a> BitXor<&'a u4> for &'a u4
type Output = <u4 as BitOr<u4>>::Output
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: &'a u4) -> <&'a u4 as BitXor<&'a u4>>::Output
impl Default for u4
impl<T> Shr<T> for u4 where
u8: Shr<T>,
<u8 as Shr<T>>::Output == u8,
u8: Shr<T>,
<u8 as Shr<T>>::Output == u8,
impl Octal for u4
impl PartialEq<u4> for u4
fn eq(&self, other: &u4) -> bool
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T> ShlAssign<T> for u4 where
u8: ShlAssign<T>,
u8: ShlAssign<T>,
fn shl_assign(&mut self, rhs: T)
impl<'a> Not for &'a u4
type Output = <u4 as Not>::Output
The resulting type after applying the !
operator.
fn not(self) -> u4
impl Not for u4
impl<T> Shl<T> for u4 where
u8: Shl<T>,
<u8 as Shl<T>>::Output == u8,
u8: Shl<T>,
<u8 as Shl<T>>::Output == u8,
impl Display for u4
impl BitXorAssign<u4> for u4
fn bitxor_assign(&mut self, other: u4)
impl LowerHex for u4
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,