Struct ketos::integer::Integer
[−]
[src]
pub struct Integer(_);
Arbitrary precision signed integer
Methods
impl Integer
[src]
fn bits(&self) -> usize
Returns the number of bits required to represent the Integer
.
fn from_bytes_be(sign: Sign, bytes: &[u8]) -> Integer
Creates an Integer
from a sign and a series of big-endian bytes.
fn from_bytes_le(sign: Sign, bytes: &[u8]) -> Integer
Creates an Integer
from a sign and a series of little-endian bytes.
fn from_f64(f: f64) -> Option<Integer>
Creates an Integer
with the value of the given f64
.
Returns None
if the value cannot be converted.
fn from_i8(i: i8) -> Integer
Creates an Integer
with the value of the given i8
.
fn from_i16(i: i16) -> Integer
Creates an Integer
with the value of the given i16
.
fn from_i32(i: i32) -> Integer
Creates an Integer
with the value of the given i32
.
fn from_i64(i: i64) -> Integer
Creates an Integer
with the value of the given i64
.
fn from_isize(i: isize) -> Integer
Creates an Integer
with the value of the given isize
.
fn from_u8(i: u8) -> Integer
Creates an Integer
with the value of the given u8
.
fn from_u16(i: u16) -> Integer
Creates an Integer
with the value of the given u16
.
fn from_u32(i: u32) -> Integer
Creates an Integer
with the value of the given u32
.
fn from_u64(i: u64) -> Integer
Creates an Integer
with the value of the given u64
.
fn from_usize(u: usize) -> Integer
Creates an Integer
with the value of the given usize
.
fn from_str_radix(s: &str, radix: u32) -> Result<Integer, FromStrRadixError>
Returns an Integer
represented by a string in the given radix.
radix
must be in the range [2, 36]
.
fn to_bytes_be(&self) -> (Sign, Vec<u8>)
Returns integer sign and a series of big-endian bytes.
fn to_bytes_le(&self) -> (Sign, Vec<u8>)
Returns integer sign and a series of little-endian bytes.
fn to_str_radix(&self, radix: u32) -> String
Returns a string representation of the Integer
in the given radix.
radix
must be in the range [2, 36]
.
fn to_i8(&self) -> Option<i8>
Returns the Integer
as an i8
value.
fn to_i16(&self) -> Option<i16>
Returns the Integer
as an i16
value.
fn to_i32(&self) -> Option<i32>
Returns the Integer
as an i32
value.
fn to_i64(&self) -> Option<i64>
Returns the Integer
as an i64
value.
fn to_isize(&self) -> Option<isize>
Returns the Integer
as an isize
value.
fn to_u8(&self) -> Option<u8>
Returns the Integer
as an u8
value.
fn to_u16(&self) -> Option<u16>
Returns the Integer
as an u16
value.
fn to_u32(&self) -> Option<u32>
Returns the Integer
as an u32
value.
fn to_u64(&self) -> Option<u64>
Returns the Integer
as an u64
value.
fn to_usize(&self) -> Option<usize>
Returns the Integer
as an usize
value.
fn to_f32(&self) -> Option<f32>
Returns the Integer
as an f32
value.
fn to_f64(&self) -> Option<f64>
Returns the Integer
as an f64
value.
fn pow(self, exp: usize) -> Integer
Raises the value to the power of exp
.
fn abs(&self) -> Integer
Returns the absolute value of an Integer
.
fn is_multiple_of(&self, rhs: &Integer) -> bool
Returns whether self
is a multiple of rhs
.
fn is_negative(&self) -> bool
Returns whether the Integer
is less than zero.
fn is_positive(&self) -> bool
Returns whether the Integer
is greater than zero.
fn is_zero(&self) -> bool
Returns whether the Integer
is equal to zero.
fn zero() -> Integer
Returns an Integer
of the value zero.
fn is_one(&self) -> bool
Returns whether the Integer
is equal to one.
fn one() -> Integer
Returns an Integer
of the value one.
Trait Implementations
impl PartialOrd for Integer
[src]
fn partial_cmp(&self, __arg_0: &Integer) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Integer) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Integer) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Integer) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Integer) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Integer
[src]
fn cmp(&self, __arg_0: &Integer) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialEq for Integer
[src]
fn eq(&self, __arg_0: &Integer) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Integer) -> bool
This method tests for !=
.
impl Eq for Integer
[src]
impl Default for Integer
[src]
impl Debug for Integer
[src]
impl Clone for Integer
[src]
fn clone(&self) -> Integer
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq<Ratio> for Integer
[src]
fn eq(&self, rhs: &Ratio) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, rhs: &Ratio) -> bool
This method tests for !=
.
impl Display for Integer
[src]
impl FromStr for Integer
[src]
type Err = FromStrIntError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Integer, FromStrIntError>
Parses a string s
to return a value of this type. Read more
impl Shl<usize> for Integer
[src]
type Output = Integer
The resulting type after applying the <<
operator
fn shl(self, rhs: usize) -> Integer
The method for the <<
operator
impl<'a> Shl<usize> for &'a Integer
[src]
type Output = Integer
The resulting type after applying the <<
operator
fn shl(self, rhs: usize) -> Integer
The method for the <<
operator
impl Shr<usize> for Integer
[src]
type Output = Integer
The resulting type after applying the >>
operator
fn shr(self, rhs: usize) -> Integer
The method for the >>
operator
impl<'a> Shr<usize> for &'a Integer
[src]
type Output = Integer
The resulting type after applying the >>
operator
fn shr(self, rhs: usize) -> Integer
The method for the >>
operator
impl Add<Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the +
operator
fn add(self, rhs: Integer) -> Integer
The method for the +
operator
impl<'a> Add<&'a Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the +
operator
fn add(self, rhs: &Integer) -> Integer
The method for the +
operator
impl<'a> Add<Integer> for &'a Integer
[src]
type Output = Integer
The resulting type after applying the +
operator
fn add(self, rhs: Integer) -> Integer
The method for the +
operator
impl<'a, 'b> Add<&'a Integer> for &'b Integer
[src]
type Output = Integer
The resulting type after applying the +
operator
fn add(self, rhs: &Integer) -> Integer
The method for the +
operator
impl Sub<Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the -
operator
fn sub(self, rhs: Integer) -> Integer
The method for the -
operator
impl<'a> Sub<&'a Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the -
operator
fn sub(self, rhs: &Integer) -> Integer
The method for the -
operator
impl<'a> Sub<Integer> for &'a Integer
[src]
type Output = Integer
The resulting type after applying the -
operator
fn sub(self, rhs: Integer) -> Integer
The method for the -
operator
impl<'a, 'b> Sub<&'a Integer> for &'b Integer
[src]
type Output = Integer
The resulting type after applying the -
operator
fn sub(self, rhs: &Integer) -> Integer
The method for the -
operator
impl Mul<Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the *
operator
fn mul(self, rhs: Integer) -> Integer
The method for the *
operator
impl<'a> Mul<&'a Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the *
operator
fn mul(self, rhs: &Integer) -> Integer
The method for the *
operator
impl<'a> Mul<Integer> for &'a Integer
[src]
type Output = Integer
The resulting type after applying the *
operator
fn mul(self, rhs: Integer) -> Integer
The method for the *
operator
impl<'a, 'b> Mul<&'a Integer> for &'b Integer
[src]
type Output = Integer
The resulting type after applying the *
operator
fn mul(self, rhs: &Integer) -> Integer
The method for the *
operator
impl Div<Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the /
operator
fn div(self, rhs: Integer) -> Integer
The method for the /
operator
impl<'a> Div<&'a Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the /
operator
fn div(self, rhs: &Integer) -> Integer
The method for the /
operator
impl<'a> Div<Integer> for &'a Integer
[src]
type Output = Integer
The resulting type after applying the /
operator
fn div(self, rhs: Integer) -> Integer
The method for the /
operator
impl<'a, 'b> Div<&'a Integer> for &'b Integer
[src]
type Output = Integer
The resulting type after applying the /
operator
fn div(self, rhs: &Integer) -> Integer
The method for the /
operator
impl Rem<Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the %
operator
fn rem(self, rhs: Integer) -> Integer
The method for the %
operator
impl<'a> Rem<&'a Integer> for Integer
[src]
type Output = Integer
The resulting type after applying the %
operator
fn rem(self, rhs: &Integer) -> Integer
The method for the %
operator
impl<'a> Rem<Integer> for &'a Integer
[src]
type Output = Integer
The resulting type after applying the %
operator
fn rem(self, rhs: Integer) -> Integer
The method for the %
operator
impl<'a, 'b> Rem<&'a Integer> for &'b Integer
[src]
type Output = Integer
The resulting type after applying the %
operator
fn rem(self, rhs: &Integer) -> Integer
The method for the %
operator
impl Neg for Integer
[src]
type Output = Integer
The resulting type after applying the -
operator
fn neg(self) -> Integer
The method for the unary -
operator
impl<'a> Neg for &'a Integer
[src]
type Output = Integer
The resulting type after applying the -
operator
fn neg(self) -> Integer
The method for the unary -
operator
impl Zero for Integer
[src]
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
fn zero() -> Integer
Returns the additive identity element of Self
, 0
. Read more
impl<'a> FromValueRef<'a> for &'a Integer
[src]
fn from_value_ref(v: &'a Value) -> Result<&'a Integer, ExecError>
Returns the borrowed value
impl FromValue for Integer
[src]
fn from_value(v: Value) -> Result<Integer, ExecError>
Consumes the Value
and returns a Rust value