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§
Sourcefn bin_encode(
&mut self,
value: u128,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_encode( &mut self, value: u128, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Encode a binary input bundle.
Sourcefn bin_receive(
&mut self,
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<BinaryBundle<Self::Item>>
fn bin_receive( &mut self, nbits: usize, channel: &mut Channel<'_>, ) -> Result<BinaryBundle<Self::Item>>
Receive an binary input bundle.
Sourcefn bin_encode_many(
&mut self,
values: &[u128],
nbits: usize,
channel: &mut Channel<'_>,
) -> Result<Vec<BinaryBundle<Self::Item>>>
fn bin_encode_many( &mut self, values: &[u128], nbits: usize, channel: &mut Channel<'_>, ) -> Result<Vec<BinaryBundle<Self::Item>>>
Encode many binary input bundles.
Sourcefn bin_receive_many(
&mut self,
ninputs: usize,
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>>>
Receive many binary input bundles.
Sourcefn bin_output(
&mut self,
x: &BinaryBundle<Self::Item>,
channel: &mut Channel<'_>,
) -> Result<Option<u128>>
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.
Sourcefn bin_outputs(
&mut self,
xs: &[BinaryBundle<Self::Item>],
channel: &mut Channel<'_>,
) -> Result<Option<Vec<u128>>>
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.