Skip to content

Commit

Permalink
Merge pull request #1254 from PyO3/abi3-new-proto
Browse files Browse the repository at this point in the history
Renew #[pyproto] implementation for abi3 branch
  • Loading branch information
kngwyu authored Oct 27, 2020
2 parents f74b649 + 16ad3bf commit 95bec25
Show file tree
Hide file tree
Showing 16 changed files with 1,172 additions and 1,287 deletions.
20 changes: 15 additions & 5 deletions guide/src/class.md
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,23 @@ impl pyo3::class::methods::HasMethodsInventory for MyClass {
}
pyo3::inventory::collect!(Pyo3MethodsInventoryForMyClass);

impl pyo3::class::proto_methods::HasProtoRegistry for MyClass {
fn registry() -> &'static pyo3::class::proto_methods::PyProtoRegistry {
static REGISTRY: pyo3::class::proto_methods::PyProtoRegistry
= pyo3::class::proto_methods::PyProtoRegistry::new();
&REGISTRY

pub struct Pyo3ProtoInventoryForMyClass {
def: pyo3::class::proto_methods::PyProtoMethodDef,
}
impl pyo3::class::proto_methods::PyProtoInventory for Pyo3ProtoInventoryForMyClass {
fn new(def: pyo3::class::proto_methods::PyProtoMethodDef) -> Self {
Self { def }
}
fn get(&'static self) -> &'static pyo3::class::proto_methods::PyProtoMethodDef {
&self.def
}
}
impl pyo3::class::proto_methods::HasProtoInventory for MyClass {
type ProtoMethods = Pyo3ProtoInventoryForMyClass;
}
pyo3::inventory::collect!(Pyo3ProtoInventoryForMyClass);


impl pyo3::pyclass::PyClassSend for MyClass {
type ThreadChecker = pyo3::pyclass::ThreadCheckerStub<MyClass>;
Expand Down
Loading

0 comments on commit 95bec25

Please sign in to comment.