qcs_api_client_common/py/
mod.rs1#[macro_export]
6macro_rules! impl_repr {
7 ($name: ident) => {
8 #[::pyo3::pymethods]
9 impl $name {
10 #[must_use]
11 fn __repr__(&self) -> String {
12 format!("{:?}", self)
13 }
14 }
15 };
16}
17
18#[macro_export]
22macro_rules! impl_eq {
23 ($name: ident) => {
24 #[::pyo3::pymethods]
25 impl $name {
26 fn __richcmp__(
27 &self,
28 py: ::pyo3::Python<'_>,
29 other: &Self,
30 op: ::pyo3::pyclass::CompareOp,
31 ) -> ::pyo3::PyObject {
32 use ::pyo3::IntoPy;
33 match op {
34 ::pyo3::pyclass::CompareOp::Eq => (self == other).into_py(py),
35 ::pyo3::pyclass::CompareOp::Ne => (self != other).into_py(py),
36 _ => py.NotImplemented(),
37 }
38 }
39 }
40 };
41}