Struct ring::arithmetic::bigint::modulus::OwnedModulus

source ·
pub struct OwnedModulus<M> {
    limbs: BoxedLimbs<M>,
    n0: N0,
    len_bits: BitLength,
}
Expand description

The modulus m for a ring ℤ/mℤ, along with the precomputed values needed for efficient Montgomery multiplication modulo m. The value must be odd and larger than 2. The larger-than-1 requirement is imposed, at least, by the modular inversion code.

Fields§

§limbs: BoxedLimbs<M>§n0: N0§len_bits: BitLength

Implementations§

source§

impl<M> OwnedModulus<M>

source

pub(crate) fn from_be_bytes(input: Input<'_>) -> Result<Self, KeyRejected>

source

pub fn verify_less_than<L>(&self, l: &Modulus<'_, L>) -> Result<(), Unspecified>

source

pub fn to_elem<L>( &self, l: &Modulus<'_, L>, ) -> Result<Elem<L, Unencoded>, Unspecified>

source

pub(crate) fn modulus(&self, cpu_features: Features) -> Modulus<'_, M>

source

pub fn len_bits(&self) -> BitLength

source§

impl<M: PublicModulus> OwnedModulus<M>

source

pub fn be_bytes( &self, ) -> LeadingZerosStripped<impl ExactSizeIterator<Item = u8> + Clone + '_>

Trait Implementations§

source§

impl<M: PublicModulus> Clone for OwnedModulus<M>

source§

fn clone(&self) -> Self

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

Auto Trait Implementations§

§

impl<M> Freeze for OwnedModulus<M>

§

impl<M> RefUnwindSafe for OwnedModulus<M>
where M: RefUnwindSafe,

§

impl<M> Send for OwnedModulus<M>
where M: Send,

§

impl<M> Sync for OwnedModulus<M>
where M: Sync,

§

impl<M> Unpin for OwnedModulus<M>
where M: Unpin,

§

impl<M> UnwindSafe for OwnedModulus<M>
where M: UnwindSafe,

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