From 2a69367888de3b53305a56c75f22a5d716664d2e Mon Sep 17 00:00:00 2001 From: kngwyu Date: Wed, 17 Jun 2020 02:19:02 +0900 Subject: [PATCH] Mark protocols setters as doc(hidden) --- src/class/basic.rs | 3 ++- src/class/buffer.rs | 2 ++ src/class/descr.rs | 2 ++ src/class/gc.rs | 1 + src/class/iter.rs | 1 + src/class/mapping.rs | 1 + src/class/number.rs | 1 + src/class/pyasync.rs | 1 + src/class/sequence.rs | 1 + 9 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/class/basic.rs b/src/class/basic.rs index 38daf9cf..9af60e51 100644 --- a/src/class/basic.rs +++ b/src/class/basic.rs @@ -153,6 +153,7 @@ pub struct PyObjectMethods { pub nb_bool: Option, } +#[doc(hidden)] impl PyObjectMethods { pub(crate) fn update_typeobj(&self, type_object: &mut ffi::PyTypeObject) { type_object.tp_str = self.tp_str; @@ -162,7 +163,7 @@ impl PyObjectMethods { type_object.tp_richcompare = self.tp_richcompare; type_object.tp_setattro = self.tp_setattro; } - + // Set functions used by `#[pyproto]`. pub fn set_str(&mut self) where T: for<'p> PyObjectStrProtocol<'p>, diff --git a/src/class/buffer.rs b/src/class/buffer.rs index 5746629d..c7766858 100644 --- a/src/class/buffer.rs +++ b/src/class/buffer.rs @@ -40,6 +40,8 @@ pub trait PyBufferReleaseBufferProtocol<'p>: PyBufferProtocol<'p> { type Result: Into>; } +/// Set functions used by `#[pyproto]`. +#[doc(hidden)] impl PyBufferProcs { pub fn set_getbuffer(&mut self) where diff --git a/src/class/descr.rs b/src/class/descr.rs index 6fcfc554..83421b44 100644 --- a/src/class/descr.rs +++ b/src/class/descr.rs @@ -71,12 +71,14 @@ pub trait PyDescrSetNameProtocol<'p>: PyDescrProtocol<'p> { type Result: Into>; } +/// All FFI functions for description protocols. #[derive(Default)] pub struct PyDescrMethods { pub tp_descr_get: Option, pub tp_descr_set: Option, } +#[doc(hidden)] impl PyDescrMethods { pub(crate) fn update_typeobj(&self, type_object: &mut ffi::PyTypeObject) { type_object.tp_descr_get = self.tp_descr_get; diff --git a/src/class/gc.rs b/src/class/gc.rs index 5f024fd2..f639b8dc 100644 --- a/src/class/gc.rs +++ b/src/class/gc.rs @@ -25,6 +25,7 @@ pub struct PyGCMethods { pub tp_clear: Option, } +#[doc(hidden)] impl PyGCMethods { pub(crate) fn update_typeobj(&self, type_object: &mut ffi::PyTypeObject) { type_object.tp_traverse = self.tp_traverse; diff --git a/src/class/iter.rs b/src/class/iter.rs index 89a96375..04fbd1e9 100644 --- a/src/class/iter.rs +++ b/src/class/iter.rs @@ -46,6 +46,7 @@ pub struct PyIterMethods { pub tp_iternext: Option, } +#[doc(hidden)] impl PyIterMethods { pub(crate) fn update_typeobj(&self, type_object: &mut ffi::PyTypeObject) { type_object.tp_iter = self.tp_iter; diff --git a/src/class/mapping.rs b/src/class/mapping.rs index b6bf839b..4e51ebed 100644 --- a/src/class/mapping.rs +++ b/src/class/mapping.rs @@ -74,6 +74,7 @@ pub trait PyMappingReversedProtocol<'p>: PyMappingProtocol<'p> { type Result: Into>; } +#[doc(hidden)] impl ffi::PyMappingMethods { pub fn set_length(&mut self) where diff --git a/src/class/number.rs b/src/class/number.rs index 4441d15b..7e6e6a10 100644 --- a/src/class/number.rs +++ b/src/class/number.rs @@ -615,6 +615,7 @@ pub trait PyNumberIndexProtocol<'p>: PyNumberProtocol<'p> { type Result: Into>; } +#[doc(hidden)] impl ffi::PyNumberMethods { pub(crate) fn from_nb_bool(nb_bool: ffi::inquiry) -> *mut Self { let mut nm = ffi::PyNumberMethods_INIT; diff --git a/src/class/pyasync.rs b/src/class/pyasync.rs index b4822e66..4cb3e102 100644 --- a/src/class/pyasync.rs +++ b/src/class/pyasync.rs @@ -89,6 +89,7 @@ pub trait PyAsyncAexitProtocol<'p>: PyAsyncProtocol<'p> { type Result: Into>; } +#[doc(hidden)] impl ffi::PyAsyncMethods { pub fn set_await(&mut self) where diff --git a/src/class/sequence.rs b/src/class/sequence.rs index b62ca91d..3a0f605d 100644 --- a/src/class/sequence.rs +++ b/src/class/sequence.rs @@ -126,6 +126,7 @@ pub trait PySequenceInplaceRepeatProtocol<'p>: PySequenceProtocol<'p> + IntoPy

>; } +#[doc(hidden)] impl ffi::PySequenceMethods { pub fn set_len(&mut self) where