Crates.io | pyo3_special_method_derive_0_21 |
lib.rs | pyo3_special_method_derive_0_21 |
version | 0.4.2 |
source | src |
created_at | 2024-07-20 00:58:37.106368 |
updated_at | 2024-07-20 00:58:37.106368 |
description | Automatically derive Python dunder methods for your Rust code |
homepage | |
repository | https://github.com/EricLBuehler/pyo3-special-method-derive |
max_upload_size | |
id | 1309184 |
size | 45,789 |
This crate enables you to automatically derive Python dunder methods for your Rust crate using PyO3.
__str__
__repr__
__dir__
__getattr__
__dict__
#[pyo3_smd(skip)]
attributepub
__str__
or __repr__
differently with the #[pyo3_smd_str(skip)]
and #[pyo3_smd_str(repr)]
attributes#[pyclass]
#[derive(Dir, Str, Repr)]
struct Person {
pub name: String,
occupation: String,
#[pyo3_smd(skip)]
pub phone_num: String,
}
To use pyo3-special-method-derive
, you should enable the multiple-pymethods
feature on PyO3:
pyo3 = { version = "0.21", features = ["multiple-pymethods"] }