diff --git a/src/circuit_json.rs b/src/circuit_json.rs index 73698b9..fba9889 100644 --- a/src/circuit_json.rs +++ b/src/circuit_json.rs @@ -48,6 +48,7 @@ pub struct Matrix { /// The units used in a [`ClassicalExp`]. #[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq, Hash)] #[serde(untagged)] +#[non_exhaustive] pub enum ClassicalExpUnit { /// Unsigned 32-bit integer. U32(u32), @@ -88,6 +89,7 @@ pub struct Conditional { // define `values` and `n_i`. #[derive(Deserialize, Serialize, Clone, Debug, PartialEq)] #[serde(untagged)] +#[non_exhaustive] pub enum Classical { /// Multi-bit operation. MultiBit { @@ -136,7 +138,8 @@ pub enum Classical { } /// Serializable operation descriptor. -#[derive(Deserialize, Serialize, Clone, Debug, PartialEq)] +#[derive(Deserialize, Serialize, Clone, Debug, Default, PartialEq)] +#[non_exhaustive] pub struct Operation

{ /// The type of operation. #[serde(rename = "type")] diff --git a/src/optype.rs b/src/optype.rs index 70cdaca..5b66da5 100644 --- a/src/optype.rs +++ b/src/optype.rs @@ -10,7 +10,7 @@ use strum::EnumString; /// Operation types in a quantum circuit. #[cfg_attr(feature = "pyo3", pyclass(name = "RsOpType"))] -#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq, Hash, EnumString)] +#[derive(Deserialize, Serialize, Clone, Debug, Default, PartialEq, Eq, Hash, EnumString)] #[non_exhaustive] pub enum OpType { /// Quantum input node of the circuit @@ -280,6 +280,7 @@ pub enum OpType { /// Identity #[allow(non_camel_case_types)] + #[default] noop, /// Measure a qubit, producing a classical output