1 | use proc_macro2::TokenStream; |
---|---|
2 | use quote::quote; |
3 | |
4 | pub(crate) fn some_wrap(obj: TokenStream) -> TokenStream { |
5 | quote! { |
6 | _pyo3::impl_::wrap::SomeWrap::wrap(#obj) |
7 | } |
8 | } |
9 | |
10 | pub(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 | |
17 | pub(crate) fn map_result_into_ptr(result: TokenStream) -> TokenStream { |
18 | quote! { |
19 | #result.map(_pyo3::PyObject::into_ptr) |
20 | } |
21 | } |
22 |