[][src]Struct ketos::integer::Integer

pub struct Integer(_);

Arbitrary precision signed integer

Methods

impl Integer[src]

pub fn bits(&self) -> usize[src]

Returns the number of bits required to represent the Integer.

pub fn from_bytes_be(sign: Sign, bytes: &[u8]) -> Integer[src]

Creates an Integer from a sign and a series of big-endian bytes.

pub fn from_bytes_le(sign: Sign, bytes: &[u8]) -> Integer[src]

Creates an Integer from a sign and a series of little-endian bytes.

pub fn from_f64(f: f64) -> Option<Integer>[src]

Creates an Integer with the value of the given f64. Returns None if the value cannot be converted.

pub fn from_i8(i: i8) -> Integer[src]

Creates an Integer with the value of the given i8.

pub fn from_i16(i: i16) -> Integer[src]

Creates an Integer with the value of the given i16.

pub fn from_i32(i: i32) -> Integer[src]

Creates an Integer with the value of the given i32.

pub fn from_i64(i: i64) -> Integer[src]

Creates an Integer with the value of the given i64.

pub fn from_isize(i: isize) -> Integer[src]

Creates an Integer with the value of the given isize.

pub fn from_u8(i: u8) -> Integer[src]

Creates an Integer with the value of the given u8.

pub fn from_u16(i: u16) -> Integer[src]

Creates an Integer with the value of the given u16.

pub fn from_u32(i: u32) -> Integer[src]

Creates an Integer with the value of the given u32.

pub fn from_u64(i: u64) -> Integer[src]

Creates an Integer with the value of the given u64.

pub fn from_usize(u: usize) -> Integer[src]

Creates an Integer with the value of the given usize.

pub fn from_str_radix(s: &str, radix: u32) -> Result<Integer, FromStrRadixError>[src]

Returns an Integer represented by a string in the given radix. radix must be in the range [2, 36].

pub fn to_bytes_be(&self) -> (Sign, Vec<u8>)[src]

Returns integer sign and a series of big-endian bytes.

pub fn to_bytes_le(&self) -> (Sign, Vec<u8>)[src]

Returns integer sign and a series of little-endian bytes.

pub fn to_str_radix(&self, radix: u32) -> String[src]

Returns a string representation of the Integer in the given radix. radix must be in the range [2, 36].

pub fn to_i8(&self) -> Option<i8>[src]

Returns the Integer as an i8 value.

pub fn to_i16(&self) -> Option<i16>[src]

Returns the Integer as an i16 value.

pub fn to_i32(&self) -> Option<i32>[src]

Returns the Integer as an i32 value.

pub fn to_i64(&self) -> Option<i64>[src]

Returns the Integer as an i64 value.

pub fn to_isize(&self) -> Option<isize>[src]

Returns the Integer as an isize value.

pub fn to_u8(&self) -> Option<u8>[src]

Returns the Integer as an u8 value.

pub fn to_u16(&self) -> Option<u16>[src]

Returns the Integer as an u16 value.

pub fn to_u32(&self) -> Option<u32>[src]

Returns the Integer as an u32 value.

pub fn to_u64(&self) -> Option<u64>[src]

Returns the Integer as an u64 value.

pub fn to_usize(&self) -> Option<usize>[src]

Returns the Integer as an usize value.

pub fn to_f32(&self) -> Option<f32>[src]

Returns the Integer as an f32 value.

pub fn to_f64(&self) -> Option<f64>[src]

Returns the Integer as an f64 value.

pub fn pow(self, exp: usize) -> Integer[src]

Raises the value to the power of exp.

pub fn abs(&self) -> Integer[src]

Returns the absolute value of an Integer.

pub fn is_multiple_of(&self, rhs: &Integer) -> bool[src]

Returns whether self is a multiple of rhs.

pub fn is_negative(&self) -> bool[src]

Returns whether the Integer is less than zero.

pub fn is_positive(&self) -> bool[src]

Returns whether the Integer is greater than zero.

pub fn is_zero(&self) -> bool[src]

Returns whether the Integer is equal to zero.

pub fn zero() -> Integer[src]

Returns an Integer of the value zero.

pub fn is_one(&self) -> bool[src]

Returns whether the Integer is equal to one.

pub fn one() -> Integer[src]

Returns an Integer of the value one.

Trait Implementations

impl<'a> Add<&'a Integer> for Integer[src]

type Output = Integer

The resulting type after applying the + operator.

impl<'a, 'b> Add<&'b Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the + operator.

impl Add<Integer> for Integer[src]

type Output = Integer

The resulting type after applying the + operator.

impl<'a> Add<Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the + operator.

impl<'a> AddAssign<&'a Integer> for Integer[src]

impl AddAssign<Integer> for Integer[src]

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

type Output = Integer

The resulting type after applying the & operator.

impl<'a, 'b> BitAnd<&'b Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the & operator.

impl BitAnd<Integer> for Integer[src]

type Output = Integer

The resulting type after applying the & operator.

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

type Output = Integer

The resulting type after applying the & operator.

impl<'a> BitAndAssign<&'a Integer> for Integer[src]

impl BitAndAssign<Integer> for Integer[src]

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

type Output = Integer

The resulting type after applying the | operator.

impl<'a, 'b> BitOr<&'b Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the | operator.

impl BitOr<Integer> for Integer[src]

type Output = Integer

The resulting type after applying the | operator.

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

type Output = Integer

The resulting type after applying the | operator.

impl<'a> BitOrAssign<&'a Integer> for Integer[src]

impl BitOrAssign<Integer> for Integer[src]

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

type Output = Integer

The resulting type after applying the ^ operator.

impl<'a, 'b> BitXor<&'b Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the ^ operator.

impl BitXor<Integer> for Integer[src]

type Output = Integer

The resulting type after applying the ^ operator.

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

type Output = Integer

The resulting type after applying the ^ operator.

impl<'a> BitXorAssign<&'a Integer> for Integer[src]

impl BitXorAssign<Integer> for Integer[src]

impl Clone for Integer[src]

impl Debug for Integer[src]

impl Default for Integer[src]

impl Display for Integer[src]

impl<'a> Div<&'a Integer> for Integer[src]

type Output = Integer

The resulting type after applying the / operator.

impl<'a, 'b> Div<&'b Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the / operator.

impl Div<Integer> for Integer[src]

type Output = Integer

The resulting type after applying the / operator.

impl<'a> Div<Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the / operator.

impl<'a> DivAssign<&'a Integer> for Integer[src]

impl DivAssign<Integer> for Integer[src]

impl Eq for Integer[src]

impl From<Integer> for Value[src]

impl FromStr for Integer[src]

type Err = FromStrIntError

The associated error which can be returned from parsing.

impl FromValue for Integer[src]

impl<'a> FromValueRef<'a> for &'a Integer[src]

impl<'a> Mul<&'a Integer> for Integer[src]

type Output = Integer

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the * operator.

impl Mul<Integer> for Integer[src]

type Output = Integer

The resulting type after applying the * operator.

impl<'a> Mul<Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the * operator.

impl<'a> MulAssign<&'a Integer> for Integer[src]

impl MulAssign<Integer> for Integer[src]

impl Neg for Integer[src]

type Output = Integer

The resulting type after applying the - operator.

impl<'a> Neg for &'a Integer[src]

type Output = Integer

The resulting type after applying the - operator.

impl Not for Integer[src]

type Output = Integer

The resulting type after applying the ! operator.

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

type Output = Integer

The resulting type after applying the ! operator.

impl Ord for Integer[src]

impl PartialEq<Integer> for Integer[src]

impl PartialEq<Integer> for Ratio[src]

impl PartialEq<Ratio> for Integer[src]

impl PartialOrd<Integer> for Integer[src]

impl<'a> Rem<&'a Integer> for Integer[src]

type Output = Integer

The resulting type after applying the % operator.

impl<'a, 'b> Rem<&'b Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the % operator.

impl Rem<Integer> for Integer[src]

type Output = Integer

The resulting type after applying the % operator.

impl<'a> Rem<Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the % operator.

impl<'a> RemAssign<&'a Integer> for Integer[src]

impl RemAssign<Integer> for Integer[src]

impl Shl<usize> for Integer[src]

type Output = Integer

The resulting type after applying the << operator.

impl<'a> Shl<usize> for &'a Integer[src]

type Output = Integer

The resulting type after applying the << operator.

impl Shr<usize> for Integer[src]

type Output = Integer

The resulting type after applying the >> operator.

impl<'a> Shr<usize> for &'a Integer[src]

type Output = Integer

The resulting type after applying the >> operator.

impl StructuralEq for Integer[src]

impl StructuralPartialEq for Integer[src]

impl<'a> Sub<&'a Integer> for Integer[src]

type Output = Integer

The resulting type after applying the - operator.

impl<'a, 'b> Sub<&'b Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the - operator.

impl Sub<Integer> for Integer[src]

type Output = Integer

The resulting type after applying the - operator.

impl<'a> Sub<Integer> for &'a Integer[src]

type Output = Integer

The resulting type after applying the - operator.

impl<'a> SubAssign<&'a Integer> for Integer[src]

impl SubAssign<Integer> for Integer[src]

impl Zero for Integer[src]

Auto Trait Implementations

impl RefUnwindSafe for Integer

impl Send for Integer

impl Sync for Integer

impl Unpin for Integer

impl UnwindSafe for Integer

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T, Rhs> NumAssignOps<Rhs> for T where
    T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>, 
[src]

impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[src]

impl<T, Base> RefNum<Base> for T where
    T: NumOps<Base, Base> + NumOps<&'r Base, Base>, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>,