Struct ux::i108

source ·
pub struct i108(/* private fields */);
Expand description

The 108-bit signed integer type.

Implementations§

source§

impl i108

The 108-bit signed integer type.

source

pub const MAX: Self = _

source

pub const MIN: Self = _

source

pub const BITS: u32 = 108u32

source§

impl i108

source

pub fn min_value() -> i108

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

source

pub fn max_value() -> i108

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

source

pub const fn new(value: i128) -> i108

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

source

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

pub 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 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§

source§

impl Add for i108

§

type Output = i108

The resulting type after applying the + operator.
source§

fn add(self, other: i108) -> i108

Performs the + operation. Read more
source§

impl Binary for i108

source§

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

Formats the value using the given formatter.
source§

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

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

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

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<'a> BitAnd for &'a i108

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl BitAnd for i108

§

type Output = i108

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl BitAndAssign for i108

source§

fn bitand_assign(&mut self, other: i108)

Performs the &= operation. Read more
source§

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

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

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

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<'a> BitOr for &'a i108

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl BitOr for i108

§

type Output = i108

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl BitOrAssign for i108

source§

fn bitor_assign(&mut self, other: i108)

Performs the |= operation. Read more
source§

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

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

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

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<'a> BitXor for &'a i108

§

type Output = <i108 as BitOr>::Output

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl BitXor for i108

§

type Output = i108

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl BitXorAssign for i108

source§

fn bitxor_assign(&mut self, other: i108)

Performs the ^= operation. Read more
source§

impl Clone for i108

source§

fn clone(&self) -> i108

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 i108

source§

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

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

impl Default for i108

source§

fn default() -> i108

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

impl Display for i108

source§

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

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

impl Hash for i108

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 i108

source§

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

Formats the value using the given formatter.
source§

impl<'a> Not for &'a i108

§

type Output = <i108 as Not>::Output

The resulting type after applying the ! operator.
source§

fn not(self) -> i108

Performs the unary ! operation. Read more
source§

impl Not for i108

§

type Output = i108

The resulting type after applying the ! operator.
source§

fn not(self) -> i108

Performs the unary ! operation. Read more
source§

impl Octal for i108

source§

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

Formats the value using the given formatter.
source§

impl Ord for i108

source§

fn cmp(&self, other: &i108) -> 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 + PartialOrd,

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

impl PartialEq for i108

source§

fn eq(&self, other: &Self) -> 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 for i108

source§

fn partial_cmp(&self, other: &i108) -> 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<T> Shl<T> for i108
where i128: Shl<T, Output = i128>,

§

type Output = i108

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

fn shl(self, rhs: T) -> i108

Performs the << operation. Read more
source§

impl<T> ShlAssign<T> for i108
where i128: ShlAssign<T>,

source§

fn shl_assign(&mut self, rhs: T)

Performs the <<= operation. Read more
source§

impl<T> Shr<T> for i108
where i128: Shr<T, Output = i128>,

§

type Output = i108

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

fn shr(self, rhs: T) -> i108

Performs the >> operation. Read more
source§

impl<T> ShrAssign<T> for i108
where i128: ShrAssign<T>,

source§

fn shr_assign(&mut self, rhs: T)

Performs the >>= operation. Read more
source§

impl Sub for i108

§

type Output = i108

The resulting type after applying the - operator.
source§

fn sub(self, other: i108) -> i108

Performs the - operation. Read more
source§

impl UpperHex for i108

source§

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

Formats the value using the given formatter.
source§

impl Copy for i108

source§

impl Eq for i108

Auto Trait Implementations§

§

impl Freeze for i108

§

impl RefUnwindSafe for i108

§

impl Send for i108

§

impl Sync for i108

§

impl Unpin for i108

§

impl UnwindSafe for i108

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> 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, U> TryFrom<U> for T
where 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 T
where 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.