Skip to main content

CtLookup

Trait CtLookup 

Source
pub trait CtLookup<Idx> {
    type Output: CtAssign;

    // Required method
    fn ct_lookup(&self, index: Idx) -> CtOption<Self::Output>;
}
Expand description

Constant-time lookup by index, similar to the Index trait, but returning an owned result in constant-time.

Required Associated Types§

Source

type Output: CtAssign

Output type returned by the lookup operation.

Required Methods§

Source

fn ct_lookup(&self, index: Idx) -> CtOption<Self::Output>

Attempt to retrieve the item at the given index, either returning it or the CtOption equivalent of None if the index was out-of-bounds.

Implementations on Foreign Types§

Source§

impl<T, Idx> CtLookup<Idx> for [T]
where T: CtAssign + Default, Idx: AddAssign + CtEq + Default + From<u8>,

Source§

type Output = T

Source§

fn ct_lookup(&self, index: Idx) -> CtOption<T>

Source§

impl<T, Idx, const N: usize> CtLookup<Idx> for [T; N]
where T: CtAssign + Default, Idx: AddAssign + CtEq + Default + From<u8>,

Source§

type Output = T

Source§

fn ct_lookup(&self, index: Idx) -> CtOption<T>

Implementors§