CHANGELOG and better docs for PyMethodsImpl

This commit is contained in:
kngwyu 2020-05-02 18:33:38 +09:00
parent 816c50a649
commit b6befcfb93
2 changed files with 11 additions and 5 deletions

View File

@ -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) * `&'static Py~` being allowed as arguments. [#869](https://github.com/PyO3/pyo3/pull/869)
* `#[pyo3(get)]` for `Py<T>`. [#880](https://github.com/PyO3/pyo3/pull/880) * `#[pyo3(get)]` for `Py<T>`. [#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] ## [0.9.2]

View File

@ -115,8 +115,10 @@ impl PySetterDef {
} }
} }
#[doc(hidden)] // Only to be used through the proc macros /// Implementation detail. Only to be used through the proc macros.
/// Allows arbitrary pymethod blocks to submit their methods, which are eventually collected by pyclass /// Allows arbitrary pymethod blocks to submit their methods, which are eventually
/// collected by pyclass.
#[doc(hidden)]
pub trait PyMethodsInventory: inventory::Collect { pub trait PyMethodsInventory: inventory::Collect {
/// Create a new instance /// Create a new instance
fn new(methods: &'static [PyMethodDefType]) -> Self; fn new(methods: &'static [PyMethodDefType]) -> Self;
@ -125,13 +127,14 @@ pub trait PyMethodsInventory: inventory::Collect {
fn get_methods(&self) -> &'static [PyMethodDefType]; 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. /// For pyclass derived structs, this trait collects method from all impl blocks using inventory.
#[doc(hidden)]
pub trait PyMethodsImpl { pub trait PyMethodsImpl {
/// Normal methods, mainly defined by `#[pymethod]`. /// Normal methods. Mainly defined by `#[pymethod]`.
type Methods: PyMethodsInventory; 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> { fn py_methods() -> Vec<&'static PyMethodDefType> {
inventory::iter::<Self::Methods> inventory::iter::<Self::Methods>
.into_iter() .into_iter()