Trait Fancy

Source
pub trait Fancy {
    type Item: Clone + HasModulus;
    type Error: Debug + Display + From<FancyError>;

    // Required methods
    fn constant(&mut self, x: u16, q: u16) -> Result<Self::Item, Self::Error>;
    fn output(&mut self, x: &Self::Item) -> Result<Option<u16>, Self::Error>;

    // Provided method
    fn outputs(
        &mut self,
        xs: &[Self::Item],
    ) -> Result<Option<Vec<u16>>, Self::Error> { ... }
}
Expand description

DSL for the basic computations supported by fancy-garbling.

Primarily used as a supertrait for FancyBinary and FancyArithmetic, which indicate computation supported by the DSL.

Required Associated Types§

Source

type Item: Clone + HasModulus

The underlying wire datatype created by an object implementing Fancy.

Source

type Error: Debug + Display + From<FancyError>

Errors which may be thrown by the users of Fancy.

Required Methods§

Source

fn constant(&mut self, x: u16, q: u16) -> Result<Self::Item, Self::Error>

Create a constant x with modulus q.

Source

fn output(&mut self, x: &Self::Item) -> Result<Option<u16>, Self::Error>

Process this wire as output. Some Fancy implementers don’t actually return output, but they need to be involved in the process, so they can return None.

Provided Methods§

Source

fn outputs( &mut self, xs: &[Self::Item], ) -> Result<Option<Vec<u16>>, Self::Error>

Output a slice of wires.

Implementors§

Source§

impl Fancy for DepthInformer

Source§

impl Fancy for Dummy

Source§

impl<C: AbstractChannel, RNG, OT, Wire: WireLabel> Fancy for fancy_garbling::twopac::semihonest::Evaluator<C, RNG, OT, Wire>

Source§

impl<C: AbstractChannel, RNG: CryptoRng + Rng, OT, Wire: WireLabel> Fancy for fancy_garbling::twopac::semihonest::Garbler<C, RNG, OT, Wire>

Source§

impl<C: AbstractChannel, RNG: RngCore + CryptoRng, Wire: WireLabel> Fancy for fancy_garbling::Garbler<C, RNG, Wire>

Source§

impl<C: AbstractChannel, Wire: WireLabel> Fancy for fancy_garbling::Evaluator<C, Wire>

Source§

impl<Circuit: CircuitType> Fancy for CircuitBuilder<Circuit>

Source§

impl<F: Fancy> Fancy for Informer<F>

Source§

type Item = <F as Fancy>::Item

Source§

type Error = <F as Fancy>::Error