Trait TpEq

Source
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§

Source

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)

Source

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)

Implementations on Foreign Types§

Source§

impl TpEq for [TpI8]

Source§

fn tp_eq(&self, other: &[TpI8]) -> TpBool

Source§

fn tp_not_eq(&self, other: &[TpI8]) -> TpBool

Source§

impl TpEq for [TpI16]

Source§

fn tp_eq(&self, other: &[TpI16]) -> TpBool

Source§

fn tp_not_eq(&self, other: &[TpI16]) -> TpBool

Source§

impl TpEq for [TpI32]

Source§

fn tp_eq(&self, other: &[TpI32]) -> TpBool

Source§

fn tp_not_eq(&self, other: &[TpI32]) -> TpBool

Source§

impl TpEq for [TpI64]

Source§

fn tp_eq(&self, other: &[TpI64]) -> TpBool

Source§

fn tp_not_eq(&self, other: &[TpI64]) -> TpBool

Source§

impl TpEq for [TpU8]

Source§

fn tp_eq(&self, other: &[TpU8]) -> TpBool

Source§

fn tp_not_eq(&self, other: &[TpU8]) -> TpBool

Source§

impl TpEq for [TpU16]

Source§

fn tp_eq(&self, other: &[TpU16]) -> TpBool

Source§

fn tp_not_eq(&self, other: &[TpU16]) -> TpBool

Source§

impl TpEq for [TpU32]

Source§

fn tp_eq(&self, other: &[TpU32]) -> TpBool

Source§

fn tp_not_eq(&self, other: &[TpU32]) -> TpBool

Source§

impl TpEq for [TpU64]

Source§

fn tp_eq(&self, other: &[TpU64]) -> TpBool

Source§

fn tp_not_eq(&self, other: &[TpU64]) -> TpBool

Source§

impl TpEq<TpBool> for bool

Source§

fn tp_eq(&self, other: &TpBool) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpBool) -> TpBool

Source§

impl TpEq<TpI8> for i8

Source§

fn tp_eq(&self, other: &TpI8) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpI8) -> TpBool

Source§

impl TpEq<TpI16> for i16

Source§

fn tp_eq(&self, other: &TpI16) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpI16) -> TpBool

Source§

impl TpEq<TpI32> for i32

Source§

fn tp_eq(&self, other: &TpI32) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpI32) -> TpBool

Source§

impl TpEq<TpI64> for i64

Source§

fn tp_eq(&self, other: &TpI64) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpI64) -> TpBool

Source§

impl TpEq<TpU8> for u8

Source§

fn tp_eq(&self, other: &TpU8) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpU8) -> TpBool

Source§

impl TpEq<TpU16> for u16

Source§

fn tp_eq(&self, other: &TpU16) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpU16) -> TpBool

Source§

impl TpEq<TpU32> for u32

Source§

fn tp_eq(&self, other: &TpU32) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpU32) -> TpBool

Source§

impl TpEq<TpU64> for u64

Source§

fn tp_eq(&self, other: &TpU64) -> TpBool

Source§

fn tp_not_eq(&self, other: &TpU64) -> TpBool

Source§

impl<T> TpEq for [T]
where T: TpEq,

Source§

default fn tp_eq(&self, other: &[T]) -> TpBool

Source§

default fn tp_not_eq(&self, other: &[T]) -> TpBool

Source§

impl<T> TpEq for Vec<T>
where T: TpEq,

Source§

fn tp_eq(&self, other: &Vec<T>) -> TpBool

Source§

fn tp_not_eq(&self, other: &Vec<T>) -> TpBool

Implementors§