Struct i113

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

The 113-bit signed integer type.

Implementations§

Source§

impl i113

The 113-bit signed integer type.

Source

pub const MAX: Self

Source

pub const MIN: Self

Source

pub const BITS: u32 = 113u32

Source§

impl i113

Source

pub fn min_value() -> i113

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

Source

pub fn max_value() -> i113

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

Source

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

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 i113

Source§

type Output = i113

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Binary for i113

Source§

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

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

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

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

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

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl<'a> BitAnd for &'a i113

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitAnd for i113

Source§

type Output = i113

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitAndAssign for i113

Source§

fn bitand_assign(&mut self, other: i113)

Performs the &= operation. Read more
Source§

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

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

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

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl<'a> BitOr for &'a i113

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitOr for i113

Source§

type Output = i113

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitOrAssign for i113

Source§

fn bitor_assign(&mut self, other: i113)

Performs the |= operation. Read more
Source§

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

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

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

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl<'a> BitXor for &'a i113

Source§

type Output = <i113 as BitOr>::Output

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl BitXor for i113

Source§

type Output = i113

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl BitXorAssign for i113

Source§

fn bitxor_assign(&mut self, other: i113)

Performs the ^= operation. Read more
Source§

impl Clone for i113

Source§

fn clone(&self) -> i113

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 i113

Source§

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

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

impl Default for i113

Source§

fn default() -> i113

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

impl Display for i113

Source§

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

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

impl Hash for i113

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 i113

Source§

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

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

impl<'a> Not for &'a i113

Source§

type Output = <i113 as Not>::Output

The resulting type after applying the ! operator.
Source§

fn not(self) -> i113

Performs the unary ! operation. Read more
Source§

impl Not for i113

Source§

type Output = i113

The resulting type after applying the ! operator.
Source§

fn not(self) -> i113

Performs the unary ! operation. Read more
Source§

impl Octal for i113

Source§

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

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

impl Ord for i113

Source§

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

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 i113

Source§

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

Source§

type Output = i113

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

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

Performs the << operation. Read more
Source§

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

Source§

fn shl_assign(&mut self, rhs: T)

Performs the <<= operation. Read more
Source§

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

Source§

type Output = i113

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

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

Performs the >> operation. Read more
Source§

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

Source§

fn shr_assign(&mut self, rhs: T)

Performs the >>= operation. Read more
Source§

impl Sub for i113

Source§

type Output = i113

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl UpperHex for i113

Source§

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

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

impl Copy for i113

Source§

impl Eq for i113

Auto Trait Implementations§

§

impl Freeze for i113

§

impl RefUnwindSafe for i113

§

impl Send for i113

§

impl Sync for i113

§

impl Unpin for i113

§

impl UnwindSafe for i113

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, 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.