1
2
3
4
5
6
7
8
9
10
11
12
13
use hugr::{
    builder::{BuildError, Dataflow},
    std_extensions::logic::LogicOp,
    Wire,
};

pub trait LogicOpBuilder: Dataflow {
    fn add_and(&mut self, x1: Wire, x2: Wire) -> Result<Wire, BuildError> {
        Ok(self.add_dataflow_op(LogicOp::And, [x1, x2])?.out_wire(0))
    }
}

impl<D: Dataflow> LogicOpBuilder for D {}