Struct nessa::number::Integer

source ·
pub struct Integer {
    pub negative: bool,
    pub limbs: Vec<u64>,
}

Fields§

§negative: bool§limbs: Vec<u64>

Implementations§

source§

impl Integer

source

pub fn new(negative: bool, limbs: Vec<u64>) -> Integer

source

pub fn is_valid_index(&self) -> bool

source

pub fn is_valid_byte(&self) -> bool

source

pub fn as_usize(&self) -> usize

source

pub fn as_u8(&self) -> u8

source

pub fn rand_with_size(digits: usize, can_be_negative: bool) -> Integer

source

pub fn rand_with_limbs(limbs: usize, can_be_negative: bool) -> Integer

source

pub fn is_even(&self) -> bool

source

pub fn is_zero(&self) -> bool

source

pub fn is_one(&self) -> bool

source

pub fn normalize_sign(&mut self) -> &Self

source

pub fn from_bin(string: &str) -> Self

source

pub fn from_hex(string: &str) -> Self

source

pub fn from_radix(string: &str, radix: u32, limb_length: usize) -> Self

source

pub fn bin(&self) -> String

source

pub fn to_f64(&self) -> f64

source§

impl Integer

source

pub fn abs(&self) -> Integer

source

pub fn fact(&self) -> Result<Integer, String>

source

pub fn rand_int_range(from: &Integer, to: &Integer) -> Result<Integer, String>

Trait Implementations§

source§

impl<'a, 'b> Add<&'a Integer> for &'b Integer

§

type Output = Integer

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Integer) -> Self::Output

Performs the + operation. Read more
source§

impl<'a> Add<&'a Integer> for Integer

§

type Output = Integer

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Integer) -> Self::Output

Performs the + operation. Read more
source§

impl<'a> Add<Integer> for &'a Integer

§

type Output = Integer

The resulting type after applying the + operator.
source§

fn add(self, rhs: Integer) -> Self::Output

Performs the + operation. Read more
source§

impl Add for Integer

§

type Output = Integer

The resulting type after applying the + operator.
source§

fn add(self, rhs: Integer) -> Self::Output

Performs the + operation. Read more
source§

impl<'a> AddAssign<&'a Integer> for Integer

source§

fn add_assign(&mut self, rhs: &Integer)

Performs the += operation. Read more
source§

impl AddAssign for Integer

source§

fn add_assign(&mut self, rhs: Integer)

Performs the += operation. Read more
source§

impl<'a, 'b> BitAnd<&'a Integer> for &'b Integer

§

type Output = Integer

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

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

§

type Output = Integer

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

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

§

type Output = Integer

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl BitAnd for Integer

§

type Output = Integer

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<'a> BitAndAssign<&'a Integer> for Integer

source§

fn bitand_assign(&mut self, rhs: &Integer)

Performs the &= operation. Read more
source§

impl BitAndAssign for Integer

source§

fn bitand_assign(&mut self, rhs: Integer)

Performs the &= operation. Read more
source§

impl<'a, 'b> BitOr<&'a Integer> for &'b Integer

§

type Output = Integer

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

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

§

type Output = Integer

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

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

§

type Output = Integer

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl BitOr for Integer

§

type Output = Integer

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<'a> BitOrAssign<&'a Integer> for Integer

source§

fn bitor_assign(&mut self, rhs: &Integer)

Performs the |= operation. Read more
source§

impl BitOrAssign for Integer

source§

fn bitor_assign(&mut self, rhs: Integer)

Performs the |= operation. Read more
source§

impl<'a, 'b> BitXor<&'a Integer> for &'b Integer

§

type Output = Integer

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

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

§

type Output = Integer

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

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

§

type Output = Integer

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl BitXor for Integer

§

type Output = Integer

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<'a> BitXorAssign<&'a Integer> for Integer

source§

fn bitxor_assign(&mut self, rhs: &Integer)

Performs the ^= operation. Read more
source§

impl BitXorAssign for Integer

source§

fn bitxor_assign(&mut self, rhs: Integer)

Performs the ^= operation. Read more
source§

impl Clone for Integer

source§

fn clone(&self) -> Integer

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 Integer

source§

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

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

impl Deref<Integer> for ObjectBlock

source§

fn deref(&self) -> Ref<'_, Integer>

source§

impl<'de> Deserialize<'de> for Integer

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Integer

source§

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

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

impl<'a, 'b> Div<&'a Integer> for &'b Integer

§

type Output = Integer

The resulting type after applying the / operator.
source§

fn div(self, rhs: &Integer) -> Self::Output

Performs the / operation. Read more
source§

impl<'a> Div<&'a Integer> for Integer

§

type Output = Integer

The resulting type after applying the / operator.
source§

fn div(self, rhs: &Integer) -> Self::Output

Performs the / operation. Read more
source§

impl<'a> Div<Integer> for &'a Integer

§

type Output = Integer

The resulting type after applying the / operator.
source§

fn div(self, rhs: Integer) -> Self::Output

Performs the / operation. Read more
source§

impl Div for Integer

§

type Output = Integer

The resulting type after applying the / operator.
source§

fn div(self, rhs: Integer) -> Self::Output

Performs the / operation. Read more
source§

impl<'a> DivAssign<&'a Integer> for Integer

source§

fn div_assign(&mut self, rhs: &Integer)

Performs the /= operation. Read more
source§

impl DivAssign for Integer

source§

fn div_assign(&mut self, rhs: Integer)

Performs the /= operation. Read more
source§

impl From<&Integer> for String

source§

fn from(n: &Integer) -> String

Converts to this type from the input type.
source§

impl From<&str> for Integer

source§

fn from(string: &str) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Integer

source§

fn from(v: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Integer

source§

fn from(v: i64) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Integer

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Integer

source§

fn from(v: u64) -> Self

Converts to this type from the input type.
source§

impl FromStr for Integer

§

type Err = String

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Integer, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Get<Integer> for ObjectBlock

source§

fn get(&self) -> &Integer

source§

impl GetMut<Integer> for ObjectBlock

source§

fn get(&mut self) -> &mut Integer

source§

impl<'a, 'b> Mul<&'a Integer> for &'b Integer

§

type Output = Integer

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Integer) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<&'a Integer> for Integer

§

type Output = Integer

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Integer) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> Mul<Integer> for &'a Integer

§

type Output = Integer

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Integer) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for Integer

§

type Output = Integer

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Integer) -> Self::Output

Performs the * operation. Read more
source§

impl<'a> MulAssign<&'a Integer> for Integer

source§

fn mul_assign(&mut self, rhs: &Integer)

Performs the *= operation. Read more
source§

impl MulAssign for Integer

source§

fn mul_assign(&mut self, rhs: Integer)

Performs the *= operation. Read more
source§

impl NessaData for Integer

source§

impl<'a> Not for &'a Integer

§

type Output = Integer

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl Not for Integer

§

type Output = Integer

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl Ord for Integer

source§

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

source§

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

source§

fn partial_cmp(&self, b: &Integer) -> 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<'a, 'b> Rem<&'a Integer> for &'b Integer

§

type Output = Integer

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &Integer) -> Self::Output

Performs the % operation. Read more
source§

impl<'a> Rem<&'a Integer> for Integer

§

type Output = Integer

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &Integer) -> Self::Output

Performs the % operation. Read more
source§

impl<'a> Rem<Integer> for &'a Integer

§

type Output = Integer

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Integer) -> Self::Output

Performs the % operation. Read more
source§

impl Rem for Integer

§

type Output = Integer

The resulting type after applying the % operator.
source§

fn rem(self, rhs: Integer) -> Self::Output

Performs the % operation. Read more
source§

impl Serialize for Integer

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a, 'b> Shl<&'a u64> for &'b Integer

§

type Output = Integer

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

fn shl(self, rhs: &u64) -> Self::Output

Performs the << operation. Read more
source§

impl<'a> Shl<&'a u64> for Integer

§

type Output = Integer

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

fn shl(self, rhs: &u64) -> Self::Output

Performs the << operation. Read more
source§

impl<'a> Shl<u64> for &'a Integer

§

type Output = Integer

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

fn shl(self, rhs: u64) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<u64> for Integer

§

type Output = Integer

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

fn shl(self, rhs: u64) -> Self::Output

Performs the << operation. Read more
source§

impl<'a> ShlAssign<&'a u64> for Integer

source§

fn shl_assign(&mut self, rhs: &u64)

Performs the <<= operation. Read more
source§

impl ShlAssign<u64> for Integer

source§

fn shl_assign(&mut self, rhs: u64)

Performs the <<= operation. Read more
source§

impl<'a, 'b> Shr<&'a u64> for &'b Integer

§

type Output = Integer

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

fn shr(self, rhs: &u64) -> Self::Output

Performs the >> operation. Read more
source§

impl<'a> Shr<&'a u64> for Integer

§

type Output = Integer

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

fn shr(self, rhs: &u64) -> Self::Output

Performs the >> operation. Read more
source§

impl<'a> Shr<u64> for &'a Integer

§

type Output = Integer

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

fn shr(self, rhs: u64) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<u64> for Integer

§

type Output = Integer

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

fn shr(self, rhs: u64) -> Self::Output

Performs the >> operation. Read more
source§

impl<'a> ShrAssign<&'a u64> for Integer

source§

fn shr_assign(&mut self, rhs: &u64)

Performs the >>= operation. Read more
source§

impl ShrAssign<u64> for Integer

source§

fn shr_assign(&mut self, rhs: u64)

Performs the >>= operation. Read more
source§

impl<'a, 'b> Sub<&'a Integer> for &'b Integer

§

type Output = Integer

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Integer) -> Self::Output

Performs the - operation. Read more
source§

impl<'a> Sub<&'a Integer> for Integer

§

type Output = Integer

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Integer) -> Self::Output

Performs the - operation. Read more
source§

impl<'a> Sub<Integer> for &'a Integer

§

type Output = Integer

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Integer) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for Integer

§

type Output = Integer

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Integer) -> Self::Output

Performs the - operation. Read more
source§

impl<'a> SubAssign<&'a Integer> for Integer

source§

fn sub_assign(&mut self, rhs: &Integer)

Performs the -= operation. Read more
source§

impl SubAssign for Integer

source§

fn sub_assign(&mut self, rhs: Integer)

Performs the -= operation. Read more
source§

impl Eq for Integer

source§

impl StructuralPartialEq for Integer

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,