rqism 0.3.5

A multi-backend quantum circuit simulator
Documentation
use crate::instruction::Instruction;

/// The circuit is currently represented as a flat list of instructions, but
/// runtime optimization of circuits might require restructuring in the
/// future.
#[derive(Clone)]
pub struct Circuit<'a> {
    pub ins: Vec<Instruction<'a>>,
    pub n: usize,
}

impl<'a> Circuit<'a> {
    pub fn stitch(&self, other: &Self) -> Self {
        Self {
            ins: self.ins.iter().chain(other.ins.iter()).cloned().collect(),
            n: self.n.max(other.n),
        }
    }
}