cairo_native_runtime

Struct HALF_PRIME

Source
pub struct HALF_PRIME { /* private fields */ }

Methods from Deref<Target = Felt>§

Source

pub const ZERO: Felt

Source

pub const ONE: Felt

Source

pub const TWO: Felt

Source

pub const THREE: Felt

Source

pub const MAX: Felt

Source

pub const ELEMENT_UPPER_BOUND: Felt

Source

pub fn to_bytes_be(&self) -> [u8; 32]

Converts to big-endian byte representation in a u8 array. This is as performant as to_bytes_le

Source

pub fn to_bytes_le(&self) -> [u8; 32]

Converts to little-endian byte representation in a u8 array. This is as performant as to_bytes_be

Source

pub fn to_hex_string(&self) -> String

Helper to produce a hexadecimal formatted string. Equivalent to calling format!("{self:#x}").

Source

pub fn to_fixed_hex_string(&self) -> String

Helper to produce a hexadecimal formatted string of 66 chars.

Source

pub fn to_bits_le(&self) -> [bool; 256]

Converts to little-endian bit representation.

Source

pub fn to_bits_be(&self) -> [bool; 256]

Converts to big-endian bit representation.

Source

pub fn field_div(&self, rhs: &NonZeroFelt) -> Felt

Finite field division.

Source

pub fn floor_div(&self, rhs: &NonZeroFelt) -> Felt

Truncated quotient between self and rhs.

Source

pub fn div_rem(&self, rhs: &NonZeroFelt) -> (Felt, Felt)

Quotient and remainder between self and rhs.

Source

pub fn inverse(&self) -> Option<Felt>

Multiplicative inverse inside field.

Source

pub fn sqrt(&self) -> Option<Felt>

Finds the square root. There may be 2 roots for each square, and the lower one is returned.

Source

pub fn square(&self) -> Felt

Raises self to the power of 2.

Source

pub fn double(&self) -> Felt

Doubles the point self

Source

pub fn pow(&self, exponent: impl Into<u128>) -> Felt

Raises self to the power of exponent.

Source

pub fn pow_felt(&self, exponent: &Felt) -> Felt

Raises self to the power of exponent.

Source

pub fn mul_mod(&self, rhs: &Felt, p: &NonZeroFelt) -> Felt

Modular multiplication between self and rhs in modulo p.

Source

pub fn mod_inverse(&self, p: &NonZeroFelt) -> Option<Felt>

Multiplicative inverse of self in modulo p.

Source

pub fn mod_floor(&self, n: &NonZeroFelt) -> Felt

Remainder of dividing self by n as integers.

Source

pub fn to_raw_reversed(&self) -> [u64; 4]

Returns the internal representation of a felt and reverses it to match starknet-rs mont representation

Source

pub fn to_raw(&self) -> [u64; 4]

Returns the internal representation of a felt

Source

pub fn to_le_digits(&self) -> [u64; 4]

Convert self’s representative into an array of u64 digits, least significant digits first.

Source

pub fn to_be_digits(&self) -> [u64; 4]

Convert self’s representative into an array of u64 digits, most significant digits first.

Source

pub fn bits(&self) -> usize

Count the minimum number of bits needed to express self’s representative.

Source

pub fn to_biguint(&self) -> BigUint

Source

pub fn to_bigint(&self) -> BigInt

Trait Implementations§

Source§

impl Deref for HALF_PRIME

Source§

type Target = Felt

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Felt

Dereferences the value.
Source§

impl LazyStatic for HALF_PRIME

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn upcast(&self) -> &T

Source§

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

Source§

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

Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more