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 ExpectedQubitsHint;
impl Metadata for ExpectedQubitsHint {
const KEY: &'static str = "tket.hint.expected_qubits";
const ALIASES: &'static [&'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 = "tket.unitary";
const ALIASES: &'static [&'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>;
}
#[deprecated(
since = "0.21.1",
note = "use explicit tket.global_phase operations instead"
)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PytketPhaseExpr;
#[expect(deprecated, reason = "the impl is retained for legacy HUGR metadata")]
impl Metadata for PytketPhaseExpr {
const KEY: &'static str = "TKET1.phase";
type Type<'hugr> = &'hugr str;
}
#[deprecated(
since = "0.21.0",
note = "use ExpectedQubitsHint instead; this alias will be removed"
)]
pub type MaxQubitsHint = ExpectedQubitsHint;