Skip to content

Commit

Permalink
fix Result repr
Browse files Browse the repository at this point in the history
  • Loading branch information
sezna committed Aug 27, 2024
1 parent ca6bb9e commit c62fbea
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pip/src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,27 @@ pub(crate) enum Result {
One,
}

#[pymethods]
impl Result {
fn __repr__(&self) -> String {
match self {
Result::Zero => "Zero".to_owned(),
Result::One => "One".to_owned(),
}
}

fn __str__(&self) -> String {
self.__repr__()
}

fn __hash__(&self) -> u32 {
match self {
Result::Zero => 0,
Result::One => 1,
}
}
}

#[derive(PartialEq)]
#[pyclass(unsendable, eq, eq_int)]
/// A Q# Pauli operator.
Expand Down

0 comments on commit c62fbea

Please sign in to comment.