pub trait ConstantTimeResult<T, E> {
// Required methods
fn ct_is_ok(&self) -> bool;
fn ct_is_err(&self) -> bool;
fn ct_map<U, F, G>(self, ok_fn: F, err_fn: G) -> U
where F: FnOnce(T) -> U,
G: FnOnce(E) -> U,
U: ConditionallySelectable;
}Expand description
Deprecated compatibility helpers for inspecting a Result.
These methods perform ordinary, data-dependent branching. Their historical
ct_ prefix is inaccurate; use Result::is_ok, Result::is_err, or
Result::map_or_else instead. No generic helper can make arbitrary closures
and enum-variant control flow constant-time.
Required Methodsยง
Sourcefn ct_is_ok(&self) -> bool
๐Deprecated: ct_is_ok branches on the Result variant; use Result::is_ok and do not treat the variant as secret
fn ct_is_ok(&self) -> bool
ct_is_ok branches on the Result variant; use Result::is_ok and do not treat the variant as secret
Equivalent to Result::is_ok; this is not constant-time.
Sourcefn ct_is_err(&self) -> bool
๐Deprecated: ct_is_err branches on the Result variant; use Result::is_err and do not treat the variant as secret
fn ct_is_err(&self) -> bool
ct_is_err branches on the Result variant; use Result::is_err and do not treat the variant as secret
Equivalent to Result::is_err; this is not constant-time.
Sourcefn ct_map<U, F, G>(self, ok_fn: F, err_fn: G) -> U
๐Deprecated: ct_map invokes only the selected closure; use Result::map_or_else and do not treat the variant as secret
fn ct_map<U, F, G>(self, ok_fn: F, err_fn: G) -> U
ct_map invokes only the selected closure; use Result::map_or_else and do not treat the variant as secret
Map the selected variant; only one closure is called.
This is not constant-time. The ConditionallySelectable bound remains
only to avoid breaking the legacy method signature.
Dyn Compatibilityยง
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".