use crate::circuit::{Instruction, StandardGate};
use crate::compile::knowledge::KnowledgeInstructionKey;
use crate::device::PhysicalQubit;
use smallvec::SmallVec;
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub(crate) struct DeviceGateState {
pub(crate) instruction: KnowledgeInstructionKey,
pub(crate) ordered_qargs: SmallVec<[PhysicalQubit; 2]>,
}
impl DeviceGateState {
pub(crate) fn standard(
gate: StandardGate,
ordered_qargs: SmallVec<[PhysicalQubit; 2]>,
) -> Self {
Self {
instruction: KnowledgeInstructionKey::Standard(gate),
ordered_qargs,
}
}
pub(crate) fn from_instruction(
instruction: &Instruction,
ordered_qargs: SmallVec<[PhysicalQubit; 2]>,
) -> Option<Self> {
Some(Self {
instruction: KnowledgeInstructionKey::from_instruction(instruction)?,
ordered_qargs,
})
}
}