From b6befcfb93e05f823e6c3f743f575c411969c1dd Mon Sep 17 00:00:00 2001 From: kngwyu Date: Sat, 2 May 2020 18:33:38 +0900 Subject: [PATCH] CHANGELOG and better docs for PyMethodsImpl --- CHANGELOG.md | 3 +++ src/class/methods.rs | 13 ++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2184bf24..20ebe010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * `&'static Py~` being allowed as arguments. [#869](https://github.com/PyO3/pyo3/pull/869) * `#[pyo3(get)]` for `Py`. [#880](https://github.com/PyO3/pyo3/pull/880) +### Removed +* `PyMethodsProtocol` is now renamed to `PyMethodsImpl` and hidden. [#889](https://github.com/PyO3/pyo3/pull/889) + ## [0.9.2] diff --git a/src/class/methods.rs b/src/class/methods.rs index bdc6c5c9..1240c972 100644 --- a/src/class/methods.rs +++ b/src/class/methods.rs @@ -115,8 +115,10 @@ impl PySetterDef { } } -#[doc(hidden)] // Only to be used through the proc macros -/// Allows arbitrary pymethod blocks to submit their methods, which are eventually collected by pyclass +/// Implementation detail. Only to be used through the proc macros. +/// Allows arbitrary pymethod blocks to submit their methods, which are eventually +/// collected by pyclass. +#[doc(hidden)] pub trait PyMethodsInventory: inventory::Collect { /// Create a new instance fn new(methods: &'static [PyMethodDefType]) -> Self; @@ -125,13 +127,14 @@ pub trait PyMethodsInventory: inventory::Collect { fn get_methods(&self) -> &'static [PyMethodDefType]; } -#[doc(hidden)] // Only to be used through the proc macros +/// Implementation detail. Only to be used through the proc macros. /// For pyclass derived structs, this trait collects method from all impl blocks using inventory. +#[doc(hidden)] pub trait PyMethodsImpl { - /// Normal methods, mainly defined by `#[pymethod]`. + /// Normal methods. Mainly defined by `#[pymethod]`. type Methods: PyMethodsInventory; - /// Returns all methods that are defined for a class + /// Returns all methods that are defined for a class. fn py_methods() -> Vec<&'static PyMethodDefType> { inventory::iter:: .into_iter()