diff --git a/src/circuit_json.rs b/src/circuit_json.rs index c4d34b2..d442abc 100644 --- a/src/circuit_json.rs +++ b/src/circuit_json.rs @@ -206,6 +206,7 @@ pub struct ImplicitPermutation(pub Register, pub Register); /// Pytket canonical serialized circuit #[derive(Deserialize, Serialize, Clone, Debug, PartialEq)] +#[non_exhaustive] pub struct SerialCircuit
{ /// The name of the circuit. #[serde(skip_serializing_if = "Option::is_none")] @@ -223,6 +224,12 @@ pub struct SerialCircuit
{
/// Number of wasm wires in the circuit.
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_ws: Option Default for Operation {
@@ -241,6 +248,22 @@ impl Default for Operation {
}
}
+impl {
+ fn default() -> Self {
+ Self {
+ name: None,
+ phase: Default::default(),
+ commands: Default::default(),
+ qubits: Default::default(),
+ bits: Default::default(),
+ implicit_permutation: Default::default(),
+ number_of_ws: None,
+ created_qubits: None,
+ discarded_qubits: None,
+ }
+ }
+}
+
impl Operation {
/// Returns a default-initialized Operation with the given type.
///
@@ -289,6 +312,21 @@ impl Command {
}
impl SerialCircuit {
+ /// Initialize a new SerialCircuit with the given name and phase.
+ pub fn new(name: Option SerialCircuit {
bits: self.bits,
implicit_permutation: self.implicit_permutation,
number_of_ws: self.number_of_ws,
+ created_qubits: self.created_qubits,
+ discarded_qubits: self.discarded_qubits,
}
}
}