Trait pyo3::conversion::ToBorrowedObject
source · pub trait ToBorrowedObject: ToPyObject {
fn with_borrowed_ptr<F, R>(&self, py: Python<'_>, f: F) -> R
where
F: FnOnce(*mut PyObject) -> R,
{ ... }
}
👎Deprecated since 0.17.0: this trait is no longer used by PyO3, use ToPyObject or IntoPy<PyObject>
Expand description
A deprecated conversion trait which relied on the unstable specialization
feature
of the Rust language.
Provided Methods
sourcefn with_borrowed_ptr<F, R>(&self, py: Python<'_>, f: F) -> Rwhere
F: FnOnce(*mut PyObject) -> R,
fn with_borrowed_ptr<F, R>(&self, py: Python<'_>, f: F) -> Rwhere
F: FnOnce(*mut PyObject) -> R,
👎Deprecated since 0.17.0: this trait is no longer used by PyO3, use ToPyObject or IntoPy<PyObject>
Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object.
May be more efficient than to_object
because it does not need
to touch any reference counts when the input object already is a Python object.