pub(crate) trait FfiPtrExt: Sealed {
// Required methods
unsafe fn assume_owned_or_err(
self,
py: Python<'_>,
) -> PyResult<Bound<'_, PyAny>>;
unsafe fn assume_owned_or_opt(
self,
py: Python<'_>,
) -> Option<Bound<'_, PyAny>>;
unsafe fn assume_owned(self, py: Python<'_>) -> Bound<'_, PyAny>;
unsafe fn assume_owned_unchecked(self, py: Python<'_>) -> Bound<'_, PyAny>;
unsafe fn assume_borrowed_or_err<'a>(
self,
py: Python<'_>,
) -> PyResult<Borrowed<'a, '_, PyAny>>;
unsafe fn assume_borrowed_or_opt<'a>(
self,
py: Python<'_>,
) -> Option<Borrowed<'a, '_, PyAny>>;
unsafe fn assume_borrowed<'a>(
self,
py: Python<'_>,
) -> Borrowed<'a, '_, PyAny>;
unsafe fn assume_borrowed_unchecked<'a>(
self,
py: Python<'_>,
) -> Borrowed<'a, '_, PyAny>;
}Required Methods§
Sourceunsafe fn assume_owned_or_err(
self,
py: Python<'_>,
) -> PyResult<Bound<'_, PyAny>>
unsafe fn assume_owned_or_err( self, py: Python<'_>, ) -> PyResult<Bound<'_, PyAny>>
Assumes this pointer carries a Python reference which needs to be decref’d.
If the pointer is NULL, this function will fetch an error.
Sourceunsafe fn assume_owned_or_opt(self, py: Python<'_>) -> Option<Bound<'_, PyAny>>
unsafe fn assume_owned_or_opt(self, py: Python<'_>) -> Option<Bound<'_, PyAny>>
Same as assume_owned_or_err, but doesn’t fetch an error on NULL.
Sourceunsafe fn assume_owned(self, py: Python<'_>) -> Bound<'_, PyAny>
unsafe fn assume_owned(self, py: Python<'_>) -> Bound<'_, PyAny>
Same as assume_owned_or_err, but panics on NULL.
Sourceunsafe fn assume_owned_unchecked(self, py: Python<'_>) -> Bound<'_, PyAny>
unsafe fn assume_owned_unchecked(self, py: Python<'_>) -> Bound<'_, PyAny>
Same as assume_owned_or_err, but does not check for NULL.
Sourceunsafe fn assume_borrowed_or_err<'a>(
self,
py: Python<'_>,
) -> PyResult<Borrowed<'a, '_, PyAny>>
unsafe fn assume_borrowed_or_err<'a>( self, py: Python<'_>, ) -> PyResult<Borrowed<'a, '_, PyAny>>
Assumes this pointer is borrowed from a parent object.
Warning: the lifetime 'a is not bounded by the function arguments; the caller is
responsible to ensure this is tied to some appropriate lifetime.
Sourceunsafe fn assume_borrowed_or_opt<'a>(
self,
py: Python<'_>,
) -> Option<Borrowed<'a, '_, PyAny>>
unsafe fn assume_borrowed_or_opt<'a>( self, py: Python<'_>, ) -> Option<Borrowed<'a, '_, PyAny>>
Same as assume_borrowed_or_err, but doesn’t fetch an error on NULL.
Sourceunsafe fn assume_borrowed<'a>(self, py: Python<'_>) -> Borrowed<'a, '_, PyAny>
unsafe fn assume_borrowed<'a>(self, py: Python<'_>) -> Borrowed<'a, '_, PyAny>
Same as assume_borrowed_or_err, but panics on NULL.
Sourceunsafe fn assume_borrowed_unchecked<'a>(
self,
py: Python<'_>,
) -> Borrowed<'a, '_, PyAny>
unsafe fn assume_borrowed_unchecked<'a>( self, py: Python<'_>, ) -> Borrowed<'a, '_, PyAny>
Same as assume_borrowed_or_err, but does not check for NULL.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl FfiPtrExt for *mut PyObject
impl FfiPtrExt for *mut PyObject
Source§unsafe fn assume_owned_or_err(
self,
py: Python<'_>,
) -> PyResult<Bound<'_, PyAny>>
unsafe fn assume_owned_or_err( self, py: Python<'_>, ) -> PyResult<Bound<'_, PyAny>>
§Safety
see requirements for Bound::from_owned_ptr_or_err
Source§unsafe fn assume_owned_or_opt(self, py: Python<'_>) -> Option<Bound<'_, PyAny>>
unsafe fn assume_owned_or_opt(self, py: Python<'_>) -> Option<Bound<'_, PyAny>>
§Safety
see requirements for Bound::from_owned_ptr_or_opt
Source§unsafe fn assume_owned(self, py: Python<'_>) -> Bound<'_, PyAny>
unsafe fn assume_owned(self, py: Python<'_>) -> Bound<'_, PyAny>
§Safety
see requirements for Bound::from_owned_ptr
Source§unsafe fn assume_owned_unchecked(self, py: Python<'_>) -> Bound<'_, PyAny>
unsafe fn assume_owned_unchecked(self, py: Python<'_>) -> Bound<'_, PyAny>
§Safety
see requirements for Bound::from_owned_ptr_unchecked
Source§unsafe fn assume_borrowed_or_err<'a>(
self,
py: Python<'_>,
) -> PyResult<Borrowed<'a, '_, PyAny>>
unsafe fn assume_borrowed_or_err<'a>( self, py: Python<'_>, ) -> PyResult<Borrowed<'a, '_, PyAny>>
§Safety
see requirements for Borrowed::from_ptr_or_err
Source§unsafe fn assume_borrowed_or_opt<'a>(
self,
py: Python<'_>,
) -> Option<Borrowed<'a, '_, PyAny>>
unsafe fn assume_borrowed_or_opt<'a>( self, py: Python<'_>, ) -> Option<Borrowed<'a, '_, PyAny>>
§Safety
see requirements for Borrowed::from_ptr_or_opt
Source§unsafe fn assume_borrowed<'a>(self, py: Python<'_>) -> Borrowed<'a, '_, PyAny>
unsafe fn assume_borrowed<'a>(self, py: Python<'_>) -> Borrowed<'a, '_, PyAny>
§Safety
see requirements for Borrowed::from_ptr
Source§unsafe fn assume_borrowed_unchecked<'a>(
self,
py: Python<'_>,
) -> Borrowed<'a, '_, PyAny>
unsafe fn assume_borrowed_unchecked<'a>( self, py: Python<'_>, ) -> Borrowed<'a, '_, PyAny>
§Safety
see requirements for Borrowed::from_ptr_unchecked