[−][src]Trait pyo3::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 ToPyPointer (we know that every ToPyObject is also ToPyObject) and uses ToPyPointer::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]
impl<T> ToBorrowedObject for T where
T: ToPyObject,
impl<T> ToBorrowedObject for T where
T: ToPyObject + ToPyPointer,
[src]
impl<T> ToBorrowedObject for T where
T: ToPyObject + ToPyPointer,