MCPcopy Create free account
hub / github.com/RustCrypto/utils / CtAssign

Interface CtAssign

ctutils/src/traits/ct_assign.rs:28–31  ·  view source on GitHub ↗

Constant-time conditional assignment: assign a given value to another based on a [`Choice`]. This crate provides built-in implementations for the following types: - [`i8`], [`i16`], [`i32`], [`i64`], [`i128`], [`isize`] - [`u8`], [`u16`], [`u32`], [`u64`], [`u128`], [`usize`] - [`NonZeroI8`], [`NonZeroI16`], [`NonZeroI32`], [`NonZeroI64`], [`NonZeroI128`], [`NonZeroI128`] - [`NonZeroU8`], [`NonZe

Source from the content-addressed store, hash-verified

26/// - `[T]` and `[T; N]` where `T` impls [`CtAssignSlice`], which the previously mentioned
27/// types all do.
28pub trait CtAssign<Rhs: ?Sized = Self> {
29 /// Conditionally assign `src` to `self` if `choice` is [`Choice::TRUE`].
30 fn ct_assign(&mut self, src: &Rhs, choice: Choice);
31}
32
33/// Implementing this trait enables use of the [`CtAssign`] trait for `[T]` where `T` is the
34/// `Self` type implementing the trait, via a blanket impl.

Callers

nothing calls this directly

Implementers 3

ct_option.rsctutils/src/ct_option.rs
choice.rsctutils/src/choice.rs
ct_assign.rsctutils/src/traits/ct_assign.rs

Calls

no outgoing calls

Tested by

no test coverage detected