Struct s2n_quic_core::ct::Number

source ·
pub struct Number<T>(/* private fields */);
Expand description

A best-effort constant-time number used for reducing branching based on secret information

Implementations§

source§

impl<T> Number<T>

source

pub fn new(value: T) -> Self

source

pub fn is_valid(&self) -> Choice

source

pub fn unwrap_or_default(&self) -> T

source

pub fn and_then<U, F, C>(self, f: F) -> Number<U>

source

pub fn filter<F, C>(self, f: F) -> Self
where T: ConditionallySelectable + Default, F: FnOnce(T) -> C, C: Into<Choice>,

source

pub fn ct_lt(self, rhs: Self) -> Choice

source

pub fn ct_le(self, rhs: Self) -> Choice

source

pub fn ct_ge(self, rhs: Self) -> Choice

source

pub fn ct_gt(self, rhs: Self) -> Choice

Trait Implementations§

source§

impl<T> Add<T> for Number<T>

§

type Output = Number<T>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T> Add for Number<T>

§

type Output = Number<T>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T> BitAnd for Number<T>

§

type Output = Number<<T as BitAnd>::Output>

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<T> BitOr for Number<T>

§

type Output = Number<<T as BitOr>::Output>

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<T> BitXor for Number<T>

§

type Output = Number<<T as BitXor>::Output>

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<T: Clone> Clone for Number<T>

source§

fn clone(&self) -> Number<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 for Number<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 for Number<T>
where T: ConstantTimeEq,

source§

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

Determine if two items are equal. Read more
source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
source§

impl<T: Debug> Debug for Number<T>

source§

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

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

impl<T> Div<T> for Number<T>

§

type Output = Number<T>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<T> Div for Number<T>

§

type Output = Number<T>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<T> From<T> for Number<T>

source§

fn from(value: T) -> Self

Converts to this type from the input type.
source§

impl<T> Mul<T> for Number<T>

§

type Output = Number<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T> Mul for Number<T>

§

type Output = Number<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T> Not for Number<T>

§

type Output = Number<<T as Not>::Output>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<T> Rem<T> for Number<T>

§

type Output = Number<T>

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl<T> Rem for Number<T>

§

type Output = Number<T>

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl<T> Shl<Number<u32>> for Number<T>

§

type Output = Number<T>

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

fn shl(self, rhs: Number<u32>) -> Self::Output

Performs the << operation. Read more
source§

impl<T> Shl<u32> for Number<T>

§

type Output = Number<T>

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

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

Performs the << operation. Read more
source§

impl<T> Shr<Number<u32>> for Number<T>

§

type Output = Number<T>

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

fn shr(self, rhs: Number<u32>) -> Self::Output

Performs the >> operation. Read more
source§

impl<T> Shr<u32> for Number<T>

§

type Output = Number<T>

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

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

Performs the >> operation. Read more
source§

impl<T> Sub<T> for Number<T>

§

type Output = Number<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T> Sub for Number<T>

§

type Output = Number<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T: Copy> Copy for Number<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Number<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<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
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.
source§

impl<T, U> Upcast<T> for U
where T: UpcastFrom<U>,

source§

fn upcast(self) -> T

source§

impl<T, B> UpcastFrom<Counter<T, B>> for T

source§

fn upcast_from(value: Counter<T, B>) -> T

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,