From 027e8686cdf00febac3b6e4703358d368e606692 Mon Sep 17 00:00:00 2001 From: "ZhengYu, Xu" Date: Thu, 14 Nov 2024 16:20:43 +0800 Subject: [PATCH] Impl __repr__ for custom vector --- src/iterators.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/iterators.rs b/src/iterators.rs index 6eecbbaeb..390aa3925 100644 --- a/src/iterators.rs +++ b/src/iterators.rs @@ -546,6 +546,10 @@ macro_rules! custom_vec_iter_impl { Python::with_gil(|py| Ok(format!("{}{}", stringify!($name), self.$data.str(py)?))) } + fn __repr__(&self) -> PyResult { + self.__str__() + } + fn __hash__(&self) -> PyResult { let mut hasher = DefaultHasher::new(); Python::with_gil(|py| PyHash::hash(&self.$data, py, &mut hasher))?;