pub trait TpEq<Rhs = Self>where
Rhs: ?Sized,{
// Required methods
fn tp_eq(&self, other: &Rhs) -> TpBool;
fn tp_not_eq(&self, other: &Rhs) -> TpBool;
}
Expand description
A trait for performing equality tests on types with timing leak protection.
Important: implementations of this trait are only required to protect inputs that are already a
timing-protected type. For example, a.tp_eq(&b)
is allowed to leak a
if a
is a u32
,
instead of a timing-protected type like TpU32
.
Ideally, this trait will be removed in the future if/when Rust allows overloading of the ==
and !=
operators.
Required Methods§
Sourcefn tp_eq(&self, other: &Rhs) -> TpBool
fn tp_eq(&self, other: &Rhs) -> TpBool
Compare self
with other
for equality without leaking the result.
Important: if either input is not a timing-protected type, this operation might leak the
value of that type. To prevent timing leaks, protect values before performing any operations
on them.
Equivalent to !a.tp_not_eq(&other)
Sourcefn tp_not_eq(&self, other: &Rhs) -> TpBool
fn tp_not_eq(&self, other: &Rhs) -> TpBool
Compare self
with other
for inequality without leaking the result.
Important: if either input is not a timing-protected type, this operation might leak the
value of that type. To prevent timing leaks, protect values before performing any operations
on them.
Equivalent to !a.tp_eq(&other)