[−][src]Trait pyo3::conversion::ToBorrowedObject
This trait has two implementations: The slow one is implemented for all ToPyObject and creates a new object using ToPyObject::to_object, while the fast one is only implemented for AsPyPointer (we know that every AsPyPointer is also ToPyObject) and uses AsPyPointer::as_ptr()
Provided methods
fn with_borrowed_ptr<F, R>(&self, py: Python<'_>, f: F) -> R where
F: FnOnce(*mut PyObject) -> R,
F: FnOnce(*mut PyObject) -> R,
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.
Implementors
impl<T> ToBorrowedObject for T where
T: ToPyObject,
[src]
T: ToPyObject,