Skip to main content

BinaryGadgets

Trait BinaryGadgets 

Source
pub trait BinaryGadgets: BundleGadgets + FancyEncode {
    // Provided methods
    fn bin_encode(
        &mut self,
        value: u128,
        nbits: usize,
        channel: &mut Channel<'_>,
    ) -> Result<BinaryBundle<Self::Item>> { ... }
    fn bin_receive(
        &mut self,
        nbits: usize,
        channel: &mut Channel<'_>,
    ) -> Result<BinaryBundle<Self::Item>> { ... }
    fn bin_encode_many(
        &mut self,
        values: &[u128],
        nbits: usize,
        channel: &mut Channel<'_>,
    ) -> Result<Vec<BinaryBundle<Self::Item>>> { ... }
    fn bin_receive_many(
        &mut self,
        ninputs: usize,
        nbits: usize,
        channel: &mut Channel<'_>,
    ) -> Result<Vec<BinaryBundle<Self::Item>>> { ... }
    fn bin_output(
        &mut self,
        x: &BinaryBundle<Self::Item>,
        channel: &mut Channel<'_>,
    ) -> Result<Option<u128>> { ... }
    fn bin_outputs(
        &mut self,
        xs: &[BinaryBundle<Self::Item>],
        channel: &mut Channel<'_>,
    ) -> Result<Option<Vec<u128>>> { ... }
}
Expand description

Extension trait for Fancy providing gadgets that operate over bundles of mod2 wires.

Provided Methods§

Source

fn bin_encode( &mut self, value: u128, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>

Encode a binary input bundle.

Source

fn bin_receive( &mut self, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>

Receive an binary input bundle.

Source

fn bin_encode_many( &mut self, values: &[u128], nbits: usize, channel: &mut Channel<'_>, ) -> Result<Vec<BinaryBundle<Self::Item>>>

Encode many binary input bundles.

Source

fn bin_receive_many( &mut self, ninputs: usize, nbits: usize, channel: &mut Channel<'_>, ) -> Result<Vec<BinaryBundle<Self::Item>>>

Receive many binary input bundles.

Source

fn bin_output( &mut self, x: &BinaryBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Option<u128>>

Output a binary bundle and interpret the result as a u128.

Source

fn bin_outputs( &mut self, xs: &[BinaryBundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Option<Vec<u128>>>

Output a slice of binary bundles and interpret the results as a u128.

Implementors§