pyo3_special_method_derive 0.2.4

Automatically derive Python dunder methods for your Rust code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use pyo3::pyclass;
use pyo3_special_method_derive::{Dir, Repr, Str};

#[pyclass]
#[derive(Dir, Str, Repr)]
#[allow(dead_code)]
struct B {
    pub z: u32,
}

#[pyclass]
#[derive(Dir, Str, Repr)]
#[allow(dead_code)]
struct A {
    pub x: u32,
    pub y: Option<B>,
}