[][src]Struct leo_compiler::program::program::ConstrainedProgram

pub struct ConstrainedProgram<F: Field + PrimeField, G: GroupType<F>> {
    pub identifiers: IndexMap<String, ConstrainedValue<F, G>>,
}

Fields

identifiers: IndexMap<String, ConstrainedValue<F, G>>

Implementations

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn evaluate_console_assert<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    indicator: &Boolean,
    expression: Expression,
    span: &Span
) -> Result<(), ConsoleError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn evaluate_console_function_call<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    indicator: &Boolean,
    console: ConsoleFunctionCall
) -> Result<(), ConsoleError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn format<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    formatted: FormattedString
) -> Result<String, ConsoleError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn store_definition(
    &mut self,
    function_scope: &str,
    mutable: bool,
    identifier: Identifier,
    value: ConstrainedValue<F, G>
)
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn store_definitions(
    &mut self,
    program: &Program,
    imported_programs: &ImportParser
) -> Result<(), ImportError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_array<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    array: Vec<SpreadOrExpression>,
    span: Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

Enforce array expressions

pub fn enforce_array_initializer<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    element_expression: Expression,
    actual_dimensions: ArrayDimensions,
    span: Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

Returns an array value from an array initializer expression.

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_array_access<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    array: Expression,
    index: RangeOrExpression,
    span: &Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_binary_expression<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    left: Expression,
    right: Expression,
    span: &Span
) -> Result<(ConstrainedValue<F, G>, ConstrainedValue<F, G>), ExpressionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_operand<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    expression: Expression,
    span: &Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

Enforce an operand of a binary expression. We don't care about mutability because we are not changing any variables. We try to resolve unresolved types here if the type is given explicitly.

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_circuit_access<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    circuit_identifier: Expression,
    circuit_member: Identifier,
    span: Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_circuit<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    identifier: Identifier,
    members: Vec<CircuitVariableDefinition>,
    span: Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_circuit_static_access<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    circuit_identifier: Expression,
    circuit_member: Identifier,
    span: Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_conditional_expression<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    conditional: Expression,
    first: Expression,
    second: Expression,
    span: &Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

Enforce ternary conditional expression

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_core_circuit_call_expression<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    core_circuit: String,
    arguments: Vec<Expression>,
    span: Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

Call a default core circuit function with arguments

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_function_call_expression<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    function: Expression,
    arguments: Vec<Expression>,
    span: Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn evaluate_identifier(
    &mut self,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    unresolved_identifier: Identifier
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

Enforce a variable expression by getting the resolved value

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_tuple_access<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    tuple: Expression,
    index: PositiveNumber,
    span: &Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_tuple<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expected_type: Option<Type>,
    tuple: Vec<Expression>,
    span: Span
) -> Result<ConstrainedValue<F, G>, ExpressionError>
[src]

Enforce tuple expressions

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn allocate_array<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    name: &str,
    array_type: Type,
    array_dimensions: ArrayDimensions,
    input_value: Option<InputValue>,
    span: &Span
) -> Result<ConstrainedValue<F, G>, FunctionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_function_input<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    scope: &str,
    caller_scope: &str,
    function_name: &str,
    expected_type: Option<Type>,
    input: Expression
) -> Result<ConstrainedValue<F, G>, FunctionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn allocate_main_function_input<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    type_: Type,
    name: &str,
    input_option: Option<InputValue>,
    span: &Span
) -> Result<ConstrainedValue<F, G>, FunctionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn allocate_input_keyword<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    keyword: InputKeyword,
    input: &Input
) -> Result<ConstrainedValue<F, G>, FunctionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn allocate_input_section<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    identifier: Identifier,
    section: IndexMap<Parameter, Option<InputValue>>
) -> Result<ConstrainedValue<F, G>, FunctionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn allocate_tuple<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    name: &str,
    types: Vec<Type>,
    input_value: Option<InputValue>,
    span: &Span
) -> Result<ConstrainedValue<F, G>, FunctionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_main_function<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    scope: &str,
    function: Function,
    input: Input
) -> Result<OutputBytes, FunctionError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn conditionally_select_result<CS: ConstraintSystem<F>>(
    cs: &mut CS,
    expected_return: Option<Type>,
    results: Vec<(Boolean, ConstrainedValue<F, G>)>,
    span: &Span
) -> Result<ConstrainedValue<F, G>, StatementError>
[src]

Returns a conditionally selected result from the given possible function returns and given function return type.

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn new() -> Self[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn assign_array<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    indicator: &Boolean,
    name: &str,
    range_or_expression: RangeOrExpression,
    new_value: ConstrainedValue<F, G>,
    span: &Span
) -> Result<(), StatementError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_assign_statement<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    declared_circuit_reference: &str,
    indicator: &Boolean,
    mut_self: bool,
    assignee: Assignee,
    expression: Expression,
    span: &Span
) -> Result<(), StatementError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn get_mutable_assignee(
    &mut self,
    name: &str,
    span: &Span
) -> Result<&mut ConstrainedValue<F, G>, StatementError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn mutate_circuit_variable<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    indicator: &Boolean,
    circuit_name: &str,
    variable_name: Identifier,
    new_value: ConstrainedValue<F, G>,
    span: &Span
) -> Result<ConstrainedValue<F, G>, StatementError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn assign_tuple<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    indicator: &Boolean,
    name: &str,
    index: PositiveNumber,
    new_value: ConstrainedValue<F, G>,
    span: &Span
) -> Result<(), StatementError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn evaluate_block<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    indicator: &Boolean,
    block: Block,
    return_type: Option<Type>,
    declared_circuit_reference: &str,
    mut_self: bool
) -> StatementResult<Vec<IndicatorAndConstrainedValue<F, G>>>
[src]

Evaluates a branch of one or more statements and returns a result in the given scope.

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_conditional_statement<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    indicator: &Boolean,
    statement: ConditionalStatement,
    return_type: Option<Type>,
    declared_circuit_reference: &str,
    mut_self: bool,
    span: &Span
) -> StatementResult<Vec<IndicatorAndConstrainedValue<F, G>>>
[src]

Enforces a conditional statement with one or more branches. Due to R1CS constraints, we must evaluate every branch to properly construct the circuit. At program execution, we will pass an indicator bit down to all child statements within each branch. The indicator bit will select that branch while keeping the constraint system satisfied.

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_definition_statement<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    declare: Declare,
    variables: Variables,
    expression: Expression,
    span: &Span
) -> Result<(), StatementError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_iteration_statement<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    indicator: &Boolean,
    index: Identifier,
    start: Expression,
    stop: Expression,
    block: Block,
    return_type: Option<Type>,
    declared_circuit_reference: &str,
    mut_self: bool,
    span: &Span
) -> StatementResult<Vec<IndicatorAndConstrainedValue<F, G>>>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_return_statement<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    expression: Expression,
    return_type: Option<Type>,
    span: &Span
) -> Result<ConstrainedValue<F, G>, StatementError>
[src]

impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G>[src]

pub fn enforce_statement<CS: ConstraintSystem<F>>(
    &mut self,
    cs: &mut CS,
    file_scope: &str,
    function_scope: &str,
    indicator: &Boolean,
    statement: Statement,
    return_type: Option<Type>,
    declared_circuit_reference: &str,
    mut_self: bool
) -> StatementResult<Vec<IndicatorAndConstrainedValue<F, G>>>
[src]

Enforce a program statement. Returns a Vector of (indicator, value) tuples. Each evaluated statement may execute of one or more statements that may return early. To indicate which of these return values to take we conditionally select the value according to the indicator bit that evaluates to true.

Trait Implementations

impl<F: Field + PrimeField, G: GroupType<F>> Default for ConstrainedProgram<F, G>[src]

Auto Trait Implementations

impl<F, G> RefUnwindSafe for ConstrainedProgram<F, G> where
    F: RefUnwindSafe,
    G: RefUnwindSafe
[src]

impl<F, G> Send for ConstrainedProgram<F, G> where
    G: Send
[src]

impl<F, G> Sync for ConstrainedProgram<F, G> where
    G: Sync
[src]

impl<F, G> Unpin for ConstrainedProgram<F, G> where
    F: Unpin,
    G: Unpin
[src]

impl<F, G> UnwindSafe for ConstrainedProgram<F, G> where
    F: RefUnwindSafe + UnwindSafe,
    G: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,