pyo3_special_method_derive 0.4.3

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
use pyo3::pyclass;
use pyo3_special_method_derive::Str;

#[pyclass(eq, eq_int)]
#[derive(Str, PartialEq)]
#[format(fmt = "Enum: {}.{}")]
enum Data {
    Alpha,
}

#[test]
fn test_formatter_enum() {
    let data = Data::Alpha;

    assert_eq!(data.__str__(), "Enum: Data.Alpha");
}