pub trait MapperBuilder<'a, DR, DW, D, E>{
type ErrorType;
// Required methods
fn user_defs(&mut self, user_defs: &str);
fn transform_helpers(&mut self);
unsafe fn add_internal<T>(
&mut self,
name: &str,
circuit: Circuit<T>,
code_config: CodeConfig<'_>,
)
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>,
<T as TryFrom<usize>>::Error: Debug,
usize: TryFrom<T>,
<usize as TryFrom<T>>::Error: Debug;
fn build(self) -> Result<Vec<E>, Self::ErrorType>;
fn word_len(&self) -> u32;
fn type_len(&self) -> u32;
fn is_data_holder_global() -> bool;
fn is_data_holder_in_builder() -> bool;
fn preferred_input_count(&self) -> usize;
// Provided methods
fn add_with_config<T>(
&mut self,
name: &str,
circuit: Circuit<T>,
code_config: CodeConfig<'_>,
)
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>,
<T as TryFrom<usize>>::Error: Debug,
usize: TryFrom<T>,
<usize as TryFrom<T>>::Error: Debug { ... }
fn add<T>(&mut self, name: &str, circuit: Circuit<T>, arg_inputs: &[usize])
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>,
<T as TryFrom<usize>>::Error: Debug,
usize: TryFrom<T>,
<usize as TryFrom<T>>::Error: Debug { ... }
}Expand description
Trait defines builder for sequential mapper.
Usage of builder is simple: first step is adding circuits to builder. Next step is building
executors by using build method. Additional methods adds helpers and an user defined code.
Builder after building should returns same number of executor as number of added
simulation configurations. This builder returns MapperExecutors.
Required Associated Types§
Required Methods§
Sourcefn user_defs(&mut self, user_defs: &str)
fn user_defs(&mut self, user_defs: &str)
Adds additional user definition to code of simulations.
Sourcefn transform_helpers(&mut self)
fn transform_helpers(&mut self)
Adds transform helpers.
Transform helpers provides macros that helps to transform data between form used while simulating circuit and external usage. They can be used in pop_input_code and aggr_output_code.
- Macro
INPUT_TRANSFORM_BXX(D0,...,DXX,S)transforms data in X-bit integers stored as 32-bit words to form fetched by simulation code.DXis output single pack element X,Sarray of 32-bit words. - Macro
OUTPUT_TRANSFORM_BXX(D,S0,....,SXX)transforms from form fetched by simulation code to data in X-bit integers stored as 32-bit words.Dis output data array of 32-bit words,SXis input pack element X.
Transform helpers are much faster than data transformers.
Sourceunsafe fn add_internal<T>(
&mut self,
name: &str,
circuit: Circuit<T>,
code_config: CodeConfig<'_>,
)
unsafe fn add_internal<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, )
Only for implementation.
Adds circuit to builder. name is name of function, circuit is circuit to simulate,
code_config is code configuration.
Sourcefn build(self) -> Result<Vec<E>, Self::ErrorType>
fn build(self) -> Result<Vec<E>, Self::ErrorType>
Build code to simulations. If build succeeded then returns executors for simulations in addition order.
Sourcefn type_len(&self) -> u32
fn type_len(&self) -> u32
Returns type length in bits (includes only type length not word length if group_vec enabled).
Sourcefn is_data_holder_global() -> bool
fn is_data_holder_global() -> bool
Returns true if any data holder is global and it can be shared between any executors from any builder of that type.
Sourcefn is_data_holder_in_builder() -> bool
fn is_data_holder_in_builder() -> bool
Returns true if any data holder is global and it can be shared between any executors from this builder.
Sourcefn preferred_input_count(&self) -> usize
fn preferred_input_count(&self) -> usize
Returns hint about preferred count of input.
Provided Methods§
Sourcefn add_with_config<T>(
&mut self,
name: &str,
circuit: Circuit<T>,
code_config: CodeConfig<'_>,
)
fn add_with_config<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, )
Adds circuit to builder. name is name of function, circuit is circuit to simulate,
code_config is code configuration.
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.