join_two_circuits

Function join_two_circuits 

Source
pub fn join_two_circuits<T>(
    circuit1: Circuit<T>,
    from_first: impl IntoIterator<Item = Option<(T, bool)>>,
    circuit2: Circuit<T>,
) -> Circuit<T>
where T: Clone + Copy + Ord + PartialEq + Eq + Debug + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug,
Expand description

Join two circuits sequentially.

A circuit1 is first circuit to join. A from_list is list of connections between first circuit outputs and second circuit inputs. A circuit2 is second circuit to join.

Any not connected circuit input will be added as input to final circuit. Any not connected circuit output will be added as output to final circuit. Function returns join of two circuits.

List of connections between first circuit outputs and second circuit inputs. List entry index is next circuit input index. Value is option of tuple of index of output from first circuit and negation of that output. Example of from_first list:

// connect first circuit output 3 to second circuit input 0.
// connect negated first circuit output 1 to second circuit input 1.
// connect negated first circuit output 4 to second circuit input 2.
vec![Some((3, false)), Some((1, true)), Some((4, true)),]

If any circuit input is connected then will be used as input in output circuit. Function returns join of all circuits.