Trait WitnessGenerator

Source
pub trait WitnessGenerator<F: FieldWitness>
where Self: Sized,
{ type Bool: BoolInterface; // Required methods fn exists<T>(&mut self, data: T) -> T where T: ToFieldElements<F> + Check<F>; fn exists_no_check<T>(&mut self, data: T) -> T where T: ToFieldElements<F>; fn exists_no_check_on_bool<T>(&mut self, b: Self::Bool, data: T) -> T where T: ToFieldElements<F>; // Provided method fn on_if<T, Fun, Fun2>( &mut self, b: Self::Bool, param: BranchParam<T, Self, Fun, Fun2>, ) -> T where T: ToFieldElements<F>, Fun: FnOnce(&mut Self) -> T, Fun2: FnOnce(&mut Self) -> T { ... } }

Required Associated Types§

Required Methods§

Source

fn exists<T>(&mut self, data: T) -> T
where T: ToFieldElements<F> + Check<F>,

Source

fn exists_no_check<T>(&mut self, data: T) -> T
where T: ToFieldElements<F>,

Source

fn exists_no_check_on_bool<T>(&mut self, b: Self::Bool, data: T) -> T
where T: ToFieldElements<F>,

Here b might be a CircuitVar::Constant, in that case we don’t call Witness::exists_no_check for the value. https://github.com/openmina/snarky/blob/ff2631f47bb644f7a31fd30be16ee0e5ff5279fa/src/base/utils.ml#L155

TODO: Ideally we should replace exists_no_check above with this exists_no_check_on_bool, but it’s more parameters to type, and most of the time b is not a constant

Provided Methods§

Source

fn on_if<T, Fun, Fun2>( &mut self, b: Self::Bool, param: BranchParam<T, Self, Fun, Fun2>, ) -> T
where T: ToFieldElements<F>, Fun: FnOnce(&mut Self) -> T, Fun2: FnOnce(&mut Self) -> T,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<F: FieldWitness> WitnessGenerator<F> for ()

Source§

type Bool = bool

Source§

fn exists<T>(&mut self, data: T) -> T
where T: ToFieldElements<F> + Check<F>,

Source§

fn exists_no_check<T>(&mut self, data: T) -> T
where T: ToFieldElements<F>,

Source§

fn exists_no_check_on_bool<T>(&mut self, _b: Self::Bool, data: T) -> T
where T: ToFieldElements<F>,

Implementors§