pub struct Encoder<Wire> { /* private fields */ }Expand description
Encode inputs statically.
Implementations§
Source§impl<Wire: WireLabel> Encoder<Wire>
impl<Wire: WireLabel> Encoder<Wire>
Sourcepub fn new(
garbler_inputs: Vec<Wire>,
evaluator_inputs: Vec<Wire>,
deltas: HashMap<u16, Wire>,
) -> Self
pub fn new( garbler_inputs: Vec<Wire>, evaluator_inputs: Vec<Wire>, deltas: HashMap<u16, Wire>, ) -> Self
Make a new Encoder from lists of garbler and evaluator inputs,
alongside a map of moduli-to-wire-offsets.
Sourcepub fn num_garbler_inputs(&self) -> usize
pub fn num_garbler_inputs(&self) -> usize
Output the number of garbler inputs.
Sourcepub fn num_evaluator_inputs(&self) -> usize
pub fn num_evaluator_inputs(&self) -> usize
Output the number of evaluator inputs.
Sourcepub fn encode_garbler_input(&self, x: u16, id: usize) -> Wire
pub fn encode_garbler_input(&self, x: u16, id: usize) -> Wire
Encode a single garbler input into its associated wire-label.
Sourcepub fn encode_evaluator_input(&self, x: u16, id: usize) -> Wire
pub fn encode_evaluator_input(&self, x: u16, id: usize) -> Wire
Encode a single evaluator input into its associated wire-label.
Sourcepub fn encode_garbler_inputs(&self, inputs: &[u16]) -> Vec<Wire>
pub fn encode_garbler_inputs(&self, inputs: &[u16]) -> Vec<Wire>
Encode a slice of garbler inputs into their associated wire-labels.
Sourcepub fn encode_evaluator_inputs(&self, inputs: &[u16]) -> Vec<Wire>
pub fn encode_evaluator_inputs(&self, inputs: &[u16]) -> Vec<Wire>
Encode a slice of evaluator inputs into their associated wire-labels.
Trait Implementations§
Source§impl<'de, Wire> Deserialize<'de> for Encoder<Wire>where
Wire: Deserialize<'de>,
impl<'de, Wire> Deserialize<'de> for Encoder<Wire>where
Wire: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<Wire> Freeze for Encoder<Wire>
impl<Wire> RefUnwindSafe for Encoder<Wire>where
Wire: RefUnwindSafe,
impl<Wire> Send for Encoder<Wire>where
Wire: Send,
impl<Wire> Sync for Encoder<Wire>where
Wire: Sync,
impl<Wire> Unpin for Encoder<Wire>where
Wire: Unpin,
impl<Wire> UnwindSafe for Encoder<Wire>where
Wire: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IsSameType<T> for T
impl<T> IsSameType<T> for T
§type EqualityProposition = TrueEqualityProposition
type EqualityProposition = TrueEqualityProposition
The [
EqualityProposition] that Self == T