Felt

Struct Felt 

Source
pub struct Felt(/* private fields */);

Implementations§

Source§

impl Felt

Source

pub const M: u64 = 18_446_744_069_414_584_321u64

Field modulus = 2^64 - 2^32 + 1

Source

pub fn from_u64_unchecked(value: u64) -> Felt

Source

pub fn new(value: u64) -> Result<Felt, FeltError>

Source

pub fn as_u64(self) -> u64

Source

pub fn is_odd(self) -> bool

Returns true if x is odd and false if x is even

Source

pub fn inv(self) -> Felt

Returns x^-1 Fails if a=0

Source

pub fn pow2(self) -> Felt

Returns 2^x Fails if x > 63

Source

pub fn exp(self, other: Felt) -> Felt

Returns a^b

Trait Implementations§

Source§

impl Add for Felt

Source§

type Output = Felt

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign for Felt

Source§

fn add_assign(&mut self, other: Felt)

Performs the += operation. Read more
Source§

impl Clone for Felt

Source§

fn clone(&self) -> Felt

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Div for Felt

Source§

type Output = Felt

The resulting type after applying the / operator.
Source§

fn div(self, other: Felt) -> Felt

Performs the / operation. Read more
Source§

impl DivAssign for Felt

Source§

fn div_assign(&mut self, other: Felt)

Performs the /= operation. Read more
Source§

impl From<AccountId> for Felt

Source§

fn from(account_id: AccountId) -> Felt

Converts to this type from the input type.
Source§

impl From<u16> for Felt

Source§

fn from(value: u16) -> Felt

Converts to this type from the input type.
Source§

impl From<u32> for Felt

Source§

fn from(value: u32) -> Felt

Converts to this type from the input type.
Source§

impl From<u8> for Felt

Source§

fn from(value: u8) -> Felt

Converts to this type from the input type.
Source§

impl Mul for Felt

Source§

type Output = Felt

The resulting type after applying the * operator.
Source§

fn mul(self, other: Felt) -> Felt

Performs the * operation. Read more
Source§

impl MulAssign for Felt

Source§

fn mul_assign(&mut self, other: Felt)

Performs the *= operation. Read more
Source§

impl Neg for Felt

Source§

type Output = Felt

The resulting type after applying the - operator.
Source§

fn neg(self) -> Felt

Performs the unary - operation. Read more
Source§

impl Ord for Felt

Source§

fn cmp(&self, other: &Felt) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl PartialEq for Felt

Source§

fn eq(&self, other: &Felt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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 Felt

Source§

fn partial_cmp(&self, other: &Felt) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn gt(&self, other: &Felt) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, other: &Felt) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

fn lt(&self, other: &Felt) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Felt) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

impl Sub for Felt

Source§

type Output = Felt

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign for Felt

Source§

fn sub_assign(&mut self, other: Felt)

Performs the -= operation. Read more
Source§

impl Copy for Felt

Source§

impl Eq for Felt

Auto Trait Implementations§

§

impl Freeze for Felt

§

impl RefUnwindSafe for Felt

§

impl Send for Felt

§

impl Sync for Felt

§

impl Unpin for Felt

§

impl UnwindSafe for Felt

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.