use crate::rewrite::trace::RewriteTrace;
use hugr_core::metadata::Metadata;
use tket_json_rs::register::{Bit, Qubit};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct MaxQubitsHint;
impl Metadata for MaxQubitsHint {
const KEY: &'static str = "tket.hint.max_qubits";
type Type<'hugr> = u32;
}
#[derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize,
)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum InlineAnnotation {
BestEffort,
Never,
}
impl Metadata for InlineAnnotation {
const KEY: &'static str = "tket.inline";
type Type<'hugr> = Self;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CircuitRewriteTraces;
impl Metadata for CircuitRewriteTraces {
const KEY: &'static str = "tket.rewrites";
type Type<'hugr> = Vec<RewriteTrace>;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct UnitaryFlags;
impl Metadata for UnitaryFlags {
const KEY: &'static str = "unitary";
type Type<'hugr> = u8;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PytketInputParameters;
impl Metadata for PytketInputParameters {
const KEY: &'static str = "TKET1.input_parameters";
type Type<'hugr> = Vec<String>;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PytketOpGroup;
impl Metadata for PytketOpGroup {
const KEY: &'static str = "TKET1.opgroup";
type Type<'hugr> = &'hugr str;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PytketBitRegisterNames;
impl Metadata for PytketBitRegisterNames {
const KEY: &'static str = "TKET1.bit_registers";
type Type<'hugr> = Vec<Bit>;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PytketQubitRegisterNames;
impl Metadata for PytketQubitRegisterNames {
const KEY: &'static str = "TKET1.qubit_registers";
type Type<'hugr> = Vec<Qubit>;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PytketPhaseExpr;
impl Metadata for PytketPhaseExpr {
const KEY: &'static str = "TKET1.phase";
type Type<'hugr> = &'hugr str;
}
#[deprecated(
since = "0.19.0",
note = "use MaxQubitsHint instead; this alias will be removed"
)]
pub type MaxQubits = MaxQubitsHint;
#[deprecated(
since = "0.19.0",
note = "use UnitaryFlags instead; this alias will be removed"
)]
pub type Unitary = UnitaryFlags;
#[deprecated(
since = "0.19.0",
note = "use PytketInputParameters instead; this alias will be removed"
)]
pub type InputParameters = PytketInputParameters;
#[deprecated(
since = "0.19.0",
note = "use PytketOpGroup instead; this alias will be removed"
)]
pub type OpGroup = PytketOpGroup;
#[deprecated(
since = "0.19.0",
note = "use PytketBitRegisterNames instead; this alias will be removed"
)]
pub type BitRegisters = PytketBitRegisterNames;
#[deprecated(
since = "0.19.0",
note = "use PytketQubitRegisterNames instead; this alias will be removed"
)]
pub type QubitRegisters = PytketQubitRegisterNames;
#[deprecated(
since = "0.19.0",
note = "use PytketPhaseExpr instead; this alias will be removed"
)]
pub type Phase = PytketPhaseExpr;