1use proc_macro2::TokenStream;
2use quote::quote;
3
4pub(crate) fn some_wrap(obj: TokenStream) -> TokenStream {
5 quote! {
6 _pyo3::impl_::wrap::SomeWrap::wrap(#obj)
7 }
8}
9
10pub(crate) fn ok_wrap(obj: TokenStream) -> TokenStream {
11 quote! {
12 _pyo3::impl_::wrap::OkWrap::wrap(#obj, py)
13 .map_err(::core::convert::Into::<_pyo3::PyErr>::into)
14 }
15}
16
17pub(crate) fn map_result_into_ptr(result: TokenStream) -> TokenStream {
18 quote! {
19 #result.map(_pyo3::PyObject::into_ptr)
20 }
21}
22