Struct crypto_bigint::Checked

source ·
pub struct Checked<T>(pub CtOption<T>);
Expand description

Provides intentionally-checked arithmetic on T.

Internally this leverages the CtOption type from the subtle crate in order to handle overflows in constant time.

Tuple Fields§

§0: CtOption<T>

Implementations§

source§

impl<T> Checked<T>

source

pub fn new(val: T) -> Self

Create a new checked arithmetic wrapper for the given value.

Trait Implementations§

source§

impl Add<&Checked<Limb>> for &Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Checked<Limb>) -> Checked<Limb>

Performs the + operation. Read more
source§

impl Add<&Checked<Limb>> for Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Checked<Limb>) -> Checked<Limb>

Performs the + operation. Read more
source§

impl<const LIMBS: usize> Add<&Checked<UInt<LIMBS>>> for &Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the + operation. Read more
source§

impl<const LIMBS: usize> Add<&Checked<UInt<LIMBS>>> for Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the + operation. Read more
source§

impl Add<Checked<Limb>> for &Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Checked<Limb>) -> Checked<Limb>

Performs the + operation. Read more
source§

impl<const LIMBS: usize> Add<Checked<UInt<LIMBS>>> for &Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the + operation. Read more
source§

impl Add for Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Checked<Limb>

Performs the + operation. Read more
source§

impl<const LIMBS: usize> Add for Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Checked<UInt<LIMBS>>

Performs the + operation. Read more
source§

impl AddAssign<&Checked<Limb>> for Checked<Limb>

source§

fn add_assign(&mut self, other: &Self)

Performs the += operation. Read more
source§

impl<const LIMBS: usize> AddAssign<&Checked<UInt<LIMBS>>> for Checked<UInt<LIMBS>>

source§

fn add_assign(&mut self, other: &Self)

Performs the += operation. Read more
source§

impl AddAssign for Checked<Limb>

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl<const LIMBS: usize> AddAssign for Checked<UInt<LIMBS>>

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl<T: Clone> Clone for Checked<T>

source§

fn clone(&self) -> Checked<T>

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<T: ConditionallySelectable> ConditionallySelectable for Checked<T>

source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
source§

impl<T: ConstantTimeEq> ConstantTimeEq for Checked<T>

source§

fn ct_eq(&self, rhs: &Self) -> Choice

Determine if two items are equal. Read more
source§

impl<T: Debug> Debug for Checked<T>

source§

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

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

impl<T> Default for Checked<T>
where T: Default,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T> From<Checked<T>> for CtOption<T>

source§

fn from(checked: Checked<T>) -> CtOption<T>

Converts to this type from the input type.
source§

impl<T> From<Checked<T>> for Option<T>

source§

fn from(checked: Checked<T>) -> Option<T>

Converts to this type from the input type.
source§

impl<T> From<CtOption<T>> for Checked<T>

source§

fn from(ct_option: CtOption<T>) -> Checked<T>

Converts to this type from the input type.
source§

impl Mul<&Checked<Limb>> for &Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Checked<Limb>) -> Checked<Limb>

Performs the * operation. Read more
source§

impl Mul<&Checked<Limb>> for Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Checked<Limb>) -> Checked<Limb>

Performs the * operation. Read more
source§

impl<const LIMBS: usize> Mul<&Checked<UInt<LIMBS>>> for &Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the * operation. Read more
source§

impl<const LIMBS: usize> Mul<&Checked<UInt<LIMBS>>> for Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the * operation. Read more
source§

impl Mul<Checked<Limb>> for &Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Checked<Limb>) -> Checked<Limb>

Performs the * operation. Read more
source§

impl<const LIMBS: usize> Mul<Checked<UInt<LIMBS>>> for &Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the * operation. Read more
source§

impl Mul for Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Checked<Limb>

Performs the * operation. Read more
source§

impl<const LIMBS: usize> Mul for Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Checked<UInt<LIMBS>>

Performs the * operation. Read more
source§

impl MulAssign<&Checked<Limb>> for Checked<Limb>

source§

fn mul_assign(&mut self, other: &Self)

Performs the *= operation. Read more
source§

impl<const LIMBS: usize> MulAssign<&Checked<UInt<LIMBS>>> for Checked<UInt<LIMBS>>

source§

fn mul_assign(&mut self, other: &Self)

Performs the *= operation. Read more
source§

impl MulAssign for Checked<Limb>

source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
source§

impl<const LIMBS: usize> MulAssign for Checked<UInt<LIMBS>>

source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
source§

impl Sub<&Checked<Limb>> for &Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Checked<Limb>) -> Checked<Limb>

Performs the - operation. Read more
source§

impl Sub<&Checked<Limb>> for Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Checked<Limb>) -> Checked<Limb>

Performs the - operation. Read more
source§

impl<const LIMBS: usize> Sub<&Checked<UInt<LIMBS>>> for &Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the - operation. Read more
source§

impl<const LIMBS: usize> Sub<&Checked<UInt<LIMBS>>> for Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the - operation. Read more
source§

impl Sub<Checked<Limb>> for &Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Checked<Limb>) -> Checked<Limb>

Performs the - operation. Read more
source§

impl<const LIMBS: usize> Sub<Checked<UInt<LIMBS>>> for &Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Checked<UInt<LIMBS>>) -> Checked<UInt<LIMBS>>

Performs the - operation. Read more
source§

impl Sub for Checked<Limb>

§

type Output = Checked<Limb>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Checked<Limb>

Performs the - operation. Read more
source§

impl<const LIMBS: usize> Sub for Checked<UInt<LIMBS>>

§

type Output = Checked<UInt<LIMBS>>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Checked<UInt<LIMBS>>

Performs the - operation. Read more
source§

impl SubAssign<&Checked<Limb>> for Checked<Limb>

source§

fn sub_assign(&mut self, other: &Self)

Performs the -= operation. Read more
source§

impl<const LIMBS: usize> SubAssign<&Checked<UInt<LIMBS>>> for Checked<UInt<LIMBS>>

source§

fn sub_assign(&mut self, other: &Self)

Performs the -= operation. Read more
source§

impl SubAssign for Checked<Limb>

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl<const LIMBS: usize> SubAssign for Checked<UInt<LIMBS>>

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl<T: Copy> Copy for Checked<T>

Auto Trait Implementations§

§

impl<T> Freeze for Checked<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Checked<T>
where T: RefUnwindSafe,

§

impl<T> Send for Checked<T>
where T: Send,

§

impl<T> Sync for Checked<T>
where T: Sync,

§

impl<T> Unpin for Checked<T>
where T: Unpin,

§

impl<T> UnwindSafe for Checked<T>
where T: 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> Same for T

§

type Output = T

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