hugr_llvm/utils/
logic_op_builder.rs1use hugr_core::{
2 Wire,
3 builder::{BuildError, Dataflow},
4 std_extensions::logic::LogicOp,
5};
6
7pub trait LogicOpBuilder: Dataflow {
8 fn add_and(&mut self, x1: Wire, x2: Wire) -> Result<Wire, BuildError> {
9 Ok(self.add_dataflow_op(LogicOp::And, [x1, x2])?.out_wire(0))
10 }
11
12 fn add_not(&mut self, x1: Wire) -> Result<Wire, BuildError> {
13 Ok(self.add_dataflow_op(LogicOp::Not, [x1])?.out_wire(0))
14 }
15}
16
17impl<D: Dataflow> LogicOpBuilder for D {}