[−][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 AsPyPointer (we know that every AsPyPointer is also ToPyObject) and uses AsPyPointer::as_ptr()
This trait should eventually be replaced with ManagedPyRef.
Required 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,
default fn with_borrowed_ptr<F, R>(&self, py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R,
[src]
F: FnOnce(*mut PyObject) -> R,
impl<T> ToBorrowedObject for T where
T: ToPyObject + AsPyPointer,
[src]
T: ToPyObject + AsPyPointer,