Skip to content

Commit

Permalink
feat: Mark more things as non-exhaustive
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Jul 9, 2024
1 parent e356cdf commit e2afab7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/circuit_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct Matrix<T = f64> {
/// 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),
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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<P = String> {
/// The type of operation.
#[serde(rename = "type")]
Expand Down
3 changes: 2 additions & 1 deletion src/optype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -280,6 +280,7 @@ pub enum OpType {

/// Identity
#[allow(non_camel_case_types)]
#[default]
noop,

/// Measure a qubit, producing a classical output
Expand Down

0 comments on commit e2afab7

Please sign in to comment.