import FromPyObject into crate root

This commit is contained in:
mejrs 2021-09-14 14:07:23 +02:00
parent 6fe52fce2f
commit 4cd9f4b570
4 changed files with 9 additions and 7 deletions

View File

@ -353,7 +353,7 @@ pub mod proc_macro {
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
#[cfg(feature = "macros")]
pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto};
pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto, FromPyObject};
#[macro_use]
mod macros;

View File

@ -10,6 +10,9 @@
//! use pyo3::prelude::*;
//! ```
pub use crate::conversion::{
FromPyObject, IntoPy, IntoPyPointer, PyTryFrom, PyTryInto, ToPyObject,
};
pub use crate::err::{PyErr, PyResult};
pub use crate::gil::GILGuard;
pub use crate::instance::{Py, PyObject};
@ -18,7 +21,6 @@ pub use crate::pyclass_init::PyClassInitializer;
pub use crate::python::Python;
pub use crate::types::{PyAny, PyModule};
pub use crate::wrap_pyfunction;
pub use crate::{FromPyObject, IntoPy, IntoPyPointer, PyTryFrom, PyTryInto, ToPyObject};
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
#[cfg(feature = "macros")]

View File

@ -1,20 +1,20 @@
#![no_implicit_prelude]
#[derive(::pyo3::prelude::FromPyObject)]
#[derive(::pyo3::FromPyObject)]
struct Derive1(i32); // newtype case
#[derive(::pyo3::prelude::FromPyObject)]
#[derive(::pyo3::FromPyObject)]
#[allow(dead_code)]
struct Derive2(i32, i32); // tuple case
#[derive(::pyo3::prelude::FromPyObject)]
#[derive(::pyo3::FromPyObject)]
#[allow(dead_code)]
struct Derive3 {
f: i32,
g: i32,
} // struct case
#[derive(::pyo3::prelude::FromPyObject)]
#[derive(::pyo3::FromPyObject)]
#[allow(dead_code)]
enum Derive4 {
A(i32),

View File

@ -1,4 +1,4 @@
use pyo3::prelude::FromPyObject;
use pyo3::FromPyObject;
#[derive(FromPyObject)]
struct Foo();