Skip to content

Commit 949537f

Browse files
authored
ctutils: add toplevel docs about CtAssign trait (#1409)
1 parent 0dbac46 commit 949537f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ctutils/src/lib.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@
6060
//! something it isn't with `Option`: evaluate combinators eagerly instead of lazily, running the
6161
//! same functions regardless of the value's effective presence or absence.
6262
//!
63+
//! ## [`CtAssign`]: constant-time additional assignment using [predication]
64+
//! Support for conditionally assigning to a type or slices thereof (for types which impl the
65+
//! [`CtAssignSlice`] trait) based on a provided condition value.
66+
//!
67+
//! Uses predication instructions or a portable simulation thereof to perform constant-time
68+
//! conditional assignment based ona [`Choice`].
69+
//!
70+
//! *NOTE: for `subtle` users, this trait provides the equivalent of the
71+
//! `ConditionallySelectable::conditional_assign` method, but as its own trait without a `Sized`
72+
//! bound so it can also be impl'd for slices*
73+
//!
6374
//! ## [`CtEq`]: constant-time analogue for [`PartialEq`]/[`Eq`]
6475
//! Equality testing often short circuits for performance reasons, but when comparing values in
6576
//! constant-time such short-circuiting is forbidden.
@@ -75,8 +86,8 @@
7586
//! using non-branch instructions which perform conditional modifications based on a *predicate*
7687
//! or boolean value, in the design of this library a `Choice`.
7788
//!
78-
//! The `CtSelect` trait provides methods for performing conditional moves, either conditionally
79-
//! modifying a value in-place, or selecting from two different inputs and returning a new one.
89+
//! The `CtSelect` trait provides methods for performing conditional selection between two
90+
//! different inputs and returning a new one.
8091
//!
8192
//! *NOTE: for `subtle` users, this is the equivalent of the `ConditionallySelectable` trait*
8293
//!

0 commit comments

Comments
 (0)