Skip to content

Commit

Permalink
Impl __repr__ for custom vector
Browse files Browse the repository at this point in the history
  • Loading branch information
zen-xu committed Nov 14, 2024
1 parent aea56cf commit 027e868
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
self.__str__()
}

fn __hash__(&self) -> PyResult<u64> {
let mut hasher = DefaultHasher::new();
Python::with_gil(|py| PyHash::hash(&self.$data, py, &mut hasher))?;
Expand Down

0 comments on commit 027e868

Please sign in to comment.