Merge pull request #1883 from mejrs/lib

Hide some macros
This commit is contained in:
David Hewitt 2021-09-23 06:07:02 +01:00 committed by GitHub
commit 0a41fb3850
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View file

@ -8,6 +8,7 @@ use std::ops;
use std::os::raw::c_char;
/// The boilerplate to convert between a Rust type and a Python exception.
#[doc(hidden)]
#[macro_export]
macro_rules! impl_exception_boilerplate {
($name: ident) => {
@ -158,6 +159,7 @@ macro_rules! create_exception {
/// `impl $crate::type_object::PyTypeObject for $name` where `$name` is an
/// exception newly defined in Rust code.
#[doc(hidden)]
#[macro_export]
macro_rules! create_exception_type_object {
($module: ident, $name: ident, $base: ty) => {

View file

@ -89,8 +89,9 @@
//!
//! ## Unstable features
//!
//! - `nightly`: Gates some optimizations that rely on [`#![feature(specialization)]`], for which
//! you'd also need nightly Rust. You should not use this feature.
//! - `nightly`: Gates some optimizations that rely on
//! [`#![feature(specialization)]`](https://github.com/rust-lang/rfcs/blob/master/text/1210-impl-specialization.md),
//! for which you'd also need nightly Rust. You should not use this feature.
//
//! ## `rustc` environment flags
//!
@ -276,8 +277,7 @@
//! [PEP 384]: https://www.python.org/dev/peps/pep-0384 "PEP 384 -- Defining a Stable ABI"
//! [Python from Rust]: https://github.com/PyO3/pyo3#using-python-from-rust
//! [Rust from Python]: https://github.com/PyO3/pyo3#using-rust-from-python
//! [`#![feature(specialization)]`]: <https://github.com/rust-lang/rfcs/blob/master/text/1210-impl-specialization.md>
//! [Features chapter of the guide]: <https://pyo3.rs/latest/features.html#features-reference> "Features Reference - PyO3 user guide"
//! [Features chapter of the guide]: https://pyo3.rs/latest/features.html#features-reference "Features Reference - PyO3 user guide"
pub use crate::class::*;
pub use crate::conversion::{
AsPyPointer, FromPyObject, FromPyPointer, IntoPy, IntoPyPointer, PyTryFrom, PyTryInto,

View file

@ -30,6 +30,7 @@ pub use self::tuple::PyTuple;
pub use self::typeobject::PyType;
// Implementations core to all native types
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_base(
($name:ty $(;$generics:ident)* ) => {
@ -75,6 +76,7 @@ macro_rules! pyobject_native_type_base(
// Implementations core to all native types except for PyAny (because they don't
// make sense on PyAny / have different implementations).
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_named (
($name:ty $(;$generics:ident)*) => {
@ -129,6 +131,7 @@ macro_rules! pyobject_native_type_named (
};
);
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_info(
($name:ty, $typeobject:expr, $module:expr $(, #checkfunction=$checkfunction:path)? $(;$generics:ident)*) => {
@ -159,6 +162,7 @@ macro_rules! pyobject_native_type_info(
// NOTE: This macro is not included in pyobject_native_type_base!
// because rust-numpy has a special implementation.
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_extract {
($name:ty $(;$generics:ident)*) => {
@ -171,6 +175,7 @@ macro_rules! pyobject_native_type_extract {
}
/// Declares all of the boilerplate for Python types.
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_core {
($name:ty, $typeobject:expr, #module=$module:expr $(, #checkfunction=$checkfunction:path)? $(;$generics:ident)*) => {
@ -183,6 +188,7 @@ macro_rules! pyobject_native_type_core {
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type_sized {
($name:ty, $layout:path $(;$generics:ident)*) => {
@ -201,6 +207,7 @@ macro_rules! pyobject_native_type_sized {
/// Declares all of the boilerplate for Python types which can be inherited from (because the exact
/// Python layout is known).
#[doc(hidden)]
#[macro_export]
macro_rules! pyobject_native_type {
($name:ty, $layout:path, $typeobject:expr $(, #module=$module:expr)? $(, #checkfunction=$checkfunction:path)? $(;$generics:ident)*) => {