pub struct Bound<'py, T>(/* private fields */);Expand description
A GIL-attached equivalent to Py.
Implementations§
source§impl<'py, T> Bound<'py, T>where
T: PyClass,
impl<'py, T> Bound<'py, T>where
T: PyClass,
sourcepub fn new(
py: Python<'py>,
value: impl Into<PyClassInitializer<T>>,
) -> PyResult<Bound<'py, T>>
pub fn new( py: Python<'py>, value: impl Into<PyClassInitializer<T>>, ) -> PyResult<Bound<'py, T>>
Creates a new instance Bound<T> of a #[pyclass] on the Python heap.
§Examples
use pyo3::prelude::*;
#[pyclass]
struct Foo {/* fields omitted */}
let foo: Py<Foo> = Python::with_gil(|py| -> PyResult<_> {
let foo: Bound<'_, Foo> = Bound::new(py, Foo {})?;
Ok(foo.into())
})?;source§impl<'py> Bound<'py, PyAny>
impl<'py> Bound<'py, PyAny>
sourcepub unsafe fn from_owned_ptr(py: Python<'py>, ptr: *mut PyObject) -> Self
pub unsafe fn from_owned_ptr(py: Python<'py>, ptr: *mut PyObject) -> Self
Constructs a new Bound<'py, PyAny> from a pointer. Panics if ptr is null.
§Safety
ptrmust be a valid pointer to a Python objectptrmust be an owned Python reference, as theBound<'py, PyAny>will assume ownership
sourcepub unsafe fn from_owned_ptr_or_opt(
py: Python<'py>,
ptr: *mut PyObject,
) -> Option<Self>
pub unsafe fn from_owned_ptr_or_opt( py: Python<'py>, ptr: *mut PyObject, ) -> Option<Self>
Constructs a new Bound<'py, PyAny> from a pointer. Returns None if ptr is null.
§Safety
ptrmust be a valid pointer to a Python object, or nullptrmust be an owned Python reference, as theBound<'py, PyAny>will assume ownership
sourcepub unsafe fn from_owned_ptr_or_err(
py: Python<'py>,
ptr: *mut PyObject,
) -> PyResult<Self>
pub unsafe fn from_owned_ptr_or_err( py: Python<'py>, ptr: *mut PyObject, ) -> PyResult<Self>
Constructs a new Bound<'py, PyAny> from a pointer. Returns an Err by calling PyErr::fetch
if ptr is null.
§Safety
ptrmust be a valid pointer to a Python object, or nullptrmust be an owned Python reference, as theBound<'py, PyAny>will assume ownership
sourcepub unsafe fn from_borrowed_ptr(py: Python<'py>, ptr: *mut PyObject) -> Self
pub unsafe fn from_borrowed_ptr(py: Python<'py>, ptr: *mut PyObject) -> Self
Constructs a new Bound<'py, PyAny> from a pointer by creating a new Python reference.
Panics if ptr is null.
§Safety
ptrmust be a valid pointer to a Python object
sourcepub unsafe fn from_borrowed_ptr_or_opt(
py: Python<'py>,
ptr: *mut PyObject,
) -> Option<Self>
pub unsafe fn from_borrowed_ptr_or_opt( py: Python<'py>, ptr: *mut PyObject, ) -> Option<Self>
Constructs a new Bound<'py, PyAny> from a pointer by creating a new Python reference.
Returns None if ptr is null.
§Safety
ptrmust be a valid pointer to a Python object, or null
sourcepub unsafe fn from_borrowed_ptr_or_err(
py: Python<'py>,
ptr: *mut PyObject,
) -> PyResult<Self>
pub unsafe fn from_borrowed_ptr_or_err( py: Python<'py>, ptr: *mut PyObject, ) -> PyResult<Self>
Constructs a new Bound<'py, PyAny> from a pointer by creating a new Python reference.
Returns an Err by calling PyErr::fetch if ptr is null.
§Safety
ptrmust be a valid pointer to a Python object, or null
source§impl<'py, T> Bound<'py, T>where
T: PyClass,
impl<'py, T> Bound<'py, T>where
T: PyClass,
sourcepub fn borrow(&self) -> PyRef<'py, T>
pub fn borrow(&self) -> PyRef<'py, T>
Immutably borrows the value T.
This borrow lasts while the returned PyRef exists.
Multiple immutable borrows can be taken out at the same time.
For frozen classes, the simpler get is available.
§Examples
#[pyclass]
struct Foo {
inner: u8,
}
Python::with_gil(|py| -> PyResult<()> {
let foo: Bound<'_, Foo> = Bound::new(py, Foo { inner: 73 })?;
let inner: &u8 = &foo.borrow().inner;
assert_eq!(*inner, 73);
Ok(())
})?;§Panics
Panics if the value is currently mutably borrowed. For a non-panicking variant, use
try_borrow.
sourcepub fn borrow_mut(&self) -> PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
pub fn borrow_mut(&self) -> PyRefMut<'py, T>where
T: PyClass<Frozen = False>,
Mutably borrows the value T.
This borrow lasts while the returned PyRefMut exists.
§Examples
#[pyclass]
struct Foo {
inner: u8,
}
Python::with_gil(|py| -> PyResult<()> {
let foo: Bound<'_, Foo> = Bound::new(py, Foo { inner: 73 })?;
foo.borrow_mut().inner = 35;
assert_eq!(foo.borrow().inner, 35);
Ok(())
})?;§Panics
Panics if the value is currently borrowed. For a non-panicking variant, use
try_borrow_mut.
sourcepub fn try_borrow(&self) -> Result<PyRef<'py, T>, PyBorrowError>
pub fn try_borrow(&self) -> Result<PyRef<'py, T>, PyBorrowError>
sourcepub fn try_borrow_mut(&self) -> Result<PyRefMut<'py, T>, PyBorrowMutError>where
T: PyClass<Frozen = False>,
pub fn try_borrow_mut(&self) -> Result<PyRefMut<'py, T>, PyBorrowMutError>where
T: PyClass<Frozen = False>,
Attempts to mutably borrow the value T, returning an error if the value is currently borrowed.
The borrow lasts while the returned PyRefMut exists.
This is the non-panicking variant of borrow_mut.
sourcepub fn get(&self) -> &T
pub fn get(&self) -> &T
Provide an immutable borrow of the value T without acquiring the GIL.
This is available if the class is frozen and Sync.
§Examples
use std::sync::atomic::{AtomicUsize, Ordering};
#[pyclass(frozen)]
struct FrozenCounter {
value: AtomicUsize,
}
Python::with_gil(|py| {
let counter = FrozenCounter { value: AtomicUsize::new(0) };
let py_counter = Bound::new(py, counter).unwrap();
py_counter.get().value.fetch_add(1, Ordering::Relaxed);
});source§impl<'py, T> Bound<'py, T>
impl<'py, T> Bound<'py, T>
sourcepub fn as_ptr(&self) -> *mut PyObject
pub fn as_ptr(&self) -> *mut PyObject
Returns the raw FFI pointer represented by self.
§Safety
Callers are responsible for ensuring that the pointer does not outlive self.
The reference is borrowed; callers should not decrease the reference count when they are finished with the pointer.
sourcepub fn into_ptr(self) -> *mut PyObject
pub fn into_ptr(self) -> *mut PyObject
Returns an owned raw FFI pointer represented by self.
§Safety
The reference is owned; when finished the caller should either transfer ownership
of the pointer or decrease the reference count (e.g. with pyo3::ffi::Py_DecRef).
sourcepub fn into_any(self) -> Bound<'py, PyAny>
pub fn into_any(self) -> Bound<'py, PyAny>
Helper to cast to Bound<'py, PyAny>, transferring ownership.
sourcepub fn as_borrowed<'a>(&'a self) -> Borrowed<'a, 'py, T>
pub fn as_borrowed<'a>(&'a self) -> Borrowed<'a, 'py, T>
Casts this Bound<T> to a Borrowed<T> smart pointer.
sourcepub fn unbind(self) -> Py<T>
pub fn unbind(self) -> Py<T>
Removes the connection for this Bound<T> from the GIL, allowing
it to cross thread boundaries.
sourcepub fn as_unbound(&self) -> &Py<T>
pub fn as_unbound(&self) -> &Py<T>
Removes the connection for this Bound<T> from the GIL, allowing
it to cross thread boundaries, without transferring ownership.
sourcepub fn as_gil_ref(&'py self) -> &'py T::AsRefTargetwhere
T: HasPyGilRef,
Available on crate feature gil-refs only.
pub fn as_gil_ref(&'py self) -> &'py T::AsRefTargetwhere
T: HasPyGilRef,
gil-refs only.Casts this Bound<T> as the corresponding “GIL Ref” type.
This is a helper to be used for migration from the deprecated “GIL Refs” API.
sourcepub fn into_gil_ref(self) -> &'py T::AsRefTargetwhere
T: HasPyGilRef,
Available on crate feature gil-refs only.
pub fn into_gil_ref(self) -> &'py T::AsRefTargetwhere
T: HasPyGilRef,
gil-refs only.Casts this Bound<T> as the corresponding “GIL Ref” type, registering the pointer on the
release pool.
This is a helper to be used for migration from the deprecated “GIL Refs” API.
Trait Implementations§
source§impl<'py> Add<&Bound<'py, PyComplex>> for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Add<&Bound<'py, PyComplex>> for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Add<Bound<'py, PyComplex>> for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Add<Bound<'py, PyComplex>> for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Add for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Add for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Add for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Add for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<T> AsPyPointer for Bound<'_, T>
impl<T> AsPyPointer for Bound<'_, T>
source§impl<'py, T> Deref for Bound<'py, T>where
T: DerefToPyAny,
impl<'py, T> Deref for Bound<'py, T>where
T: DerefToPyAny,
source§impl<'py> Div<&Bound<'py, PyComplex>> for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Div<&Bound<'py, PyComplex>> for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Div<Bound<'py, PyComplex>> for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Div<Bound<'py, PyComplex>> for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Div for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Div for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Div for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Div for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl From<Bound<'_, PyByteArray>> for PyBackedBytes
impl From<Bound<'_, PyByteArray>> for PyBackedBytes
source§fn from(py_bytearray: Bound<'_, PyByteArray>) -> Self
fn from(py_bytearray: Bound<'_, PyByteArray>) -> Self
source§impl<'py, T: PyClass> From<Bound<'py, T>> for PyClassInitializer<T>
impl<'py, T: PyClass> From<Bound<'py, T>> for PyClassInitializer<T>
source§fn from(value: Bound<'py, T>) -> PyClassInitializer<T>
fn from(value: Bound<'py, T>) -> PyClassInitializer<T>
source§impl<'py, T> FromPyObject<'py> for Bound<'py, T>where
T: PyTypeCheck,
impl<'py, T> FromPyObject<'py> for Bound<'py, T>where
T: PyTypeCheck,
source§fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self>
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self>
Extracts Self from the source PyObject.
source§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
experimental-inspect only.source§impl<I: SliceIndex<[u8]>> Index<I> for Bound<'_, PyBytes>
impl<I: SliceIndex<[u8]>> Index<I> for Bound<'_, PyBytes>
This is the same way Vec is indexed.
source§impl<'py> IntoIterator for &Bound<'py, PyDict>
impl<'py> IntoIterator for &Bound<'py, PyDict>
source§impl<'py> IntoIterator for &Bound<'py, PyFrozenSet>
impl<'py> IntoIterator for &Bound<'py, PyFrozenSet>
source§impl<'py> IntoIterator for &Bound<'py, PyIterator>
impl<'py> IntoIterator for &Bound<'py, PyIterator>
source§impl<'py> IntoIterator for &Bound<'py, PyList>
impl<'py> IntoIterator for &Bound<'py, PyList>
source§impl<'py> IntoIterator for &Bound<'py, PySet>
impl<'py> IntoIterator for &Bound<'py, PySet>
source§impl<'py> IntoIterator for &Bound<'py, PyTuple>
impl<'py> IntoIterator for &Bound<'py, PyTuple>
source§impl<'py> IntoIterator for Bound<'py, PyDict>
impl<'py> IntoIterator for Bound<'py, PyDict>
source§impl<'py> IntoIterator for Bound<'py, PyFrozenSet>
impl<'py> IntoIterator for Bound<'py, PyFrozenSet>
source§impl<'py> IntoIterator for Bound<'py, PyList>
impl<'py> IntoIterator for Bound<'py, PyList>
source§impl<'py> IntoIterator for Bound<'py, PySet>
impl<'py> IntoIterator for Bound<'py, PySet>
source§impl<'py> IntoIterator for Bound<'py, PyTuple>
impl<'py> IntoIterator for Bound<'py, PyTuple>
source§impl<T> IntoPy<Py<PyAny>> for &Bound<'_, T>
impl<T> IntoPy<Py<PyAny>> for &Bound<'_, T>
source§fn into_py(self, py: Python<'_>) -> PyObject
fn into_py(self, py: Python<'_>) -> PyObject
Converts &Bound instance -> PyObject, increasing the reference count.
source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
experimental-inspect only.source§impl<'py> Iterator for Bound<'py, PyIterator>
impl<'py> Iterator for Bound<'py, PyIterator>
source§fn next(&mut self) -> Option<Self::Item>
fn next(&mut self) -> Option<Self::Item>
Retrieves the next item from an iterator.
Returns None when the iterator is exhausted.
If an exception occurs, returns Some(Err(..)).
Further next() calls after an exception occurs are likely
to repeatedly result in the same exception.
source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
source§fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
iter_next_chunk)N values. Read more1.0.0 · source§fn count(self) -> usizewhere
Self: Sized,
fn count(self) -> usizewhere
Self: Sized,
1.0.0 · source§fn last(self) -> Option<Self::Item>where
Self: Sized,
fn last(self) -> Option<Self::Item>where
Self: Sized,
source§fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by)n elements. Read more1.0.0 · source§fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
nth element of the iterator. Read more1.28.0 · source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
1.0.0 · source§fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
1.0.0 · source§fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
source§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse)separator
between adjacent items of the original iterator. Read more1.0.0 · source§fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.0.0 · source§fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 · source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 · source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
1.0.0 · source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 · source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 · source§fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 · source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n elements. Read more1.0.0 · source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n elements, or fewer
if the underlying iterator ends sooner. Read more1.0.0 · source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
source§fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
iter_map_windows)f for each contiguous window of size N over
self and returns an iterator over the outputs of f. Like slice::windows(),
the windows during mapping overlap as well. Read more1.0.0 · source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
source§fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into)1.0.0 · source§fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
source§fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned)true precede all those that return false. Read more1.27.0 · source§fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
1.27.0 · source§fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 · source§fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 · source§fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
source§fn try_reduce<R>(
&mut self,
f: impl FnMut(Self::Item, Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>( &mut self, f: impl FnMut(Self::Item, Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce)1.0.0 · source§fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 · source§fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 · source§fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 · source§fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
source§fn try_find<R>(
&mut self,
f: impl FnMut(&Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>( &mut self, f: impl FnMut(&Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find)1.0.0 · source§fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.6.0 · source§fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · source§fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 · source§fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · source§fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 · source§fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 · source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
source§fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
iter_array_chunks)N elements of the iterator at a time. Read more1.11.0 · source§fn product<P>(self) -> P
fn product<P>(self) -> P
source§fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
iter_order_by)Iterator with those
of another with respect to the specified comparison function. Read more1.5.0 · source§fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd elements of
this Iterator with those of another. The comparison works like short-circuit
evaluation, returning a result without comparing the remaining elements.
As soon as an order can be determined, the evaluation stops and a result is returned. Read moresource§fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by)Iterator with those
of another with respect to the specified comparison function. Read moresource§fn eq_by<I, F>(self, other: I, eq: F) -> bool
fn eq_by<I, F>(self, other: I, eq: F) -> bool
iter_order_by)1.5.0 · source§fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator are lexicographically
less than those of another. Read more1.5.0 · source§fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator are lexicographically
less or equal to those of another. Read more1.5.0 · source§fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator are lexicographically
greater than those of another. Read more1.5.0 · source§fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator are lexicographically
greater than or equal to those of another. Read moresource§fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
is_sorted)source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
is_sorted)source§impl<'py> Mul<&Bound<'py, PyComplex>> for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Mul<&Bound<'py, PyComplex>> for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Mul<Bound<'py, PyComplex>> for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Mul<Bound<'py, PyComplex>> for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Mul for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Mul for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Mul for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Mul for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Neg for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Neg for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Neg for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Neg for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl PartialEq<&[u8]> for Bound<'_, PyBytes>
impl PartialEq<&[u8]> for Bound<'_, PyBytes>
Compares whether the Python bytes object is equal to the u8.
In some cases Python equality might be more appropriate; see the note on PyBytes.
source§impl PartialEq<&Bound<'_, PyBytes>> for [u8]
impl PartialEq<&Bound<'_, PyBytes>> for [u8]
Compares whether the Python bytes object is equal to the u8.
In some cases Python equality might be more appropriate; see the note on PyBytes.
source§impl PartialEq<&Bound<'_, PyString>> for str
impl PartialEq<&Bound<'_, PyString>> for str
Compares whether the data in the Python string is equal to the given UTF8.
In some cases Python equality might be more appropriate; see the note on PyString.
source§impl PartialEq<&str> for Bound<'_, PyString>
impl PartialEq<&str> for Bound<'_, PyString>
Compares whether the data in the Python string is equal to the given UTF8.
In some cases Python equality might be more appropriate; see the note on PyString.
source§impl PartialEq<[u8]> for &Bound<'_, PyBytes>
impl PartialEq<[u8]> for &Bound<'_, PyBytes>
Compares whether the Python bytes object is equal to the u8.
In some cases Python equality might be more appropriate; see the note on PyBytes.
source§impl PartialEq<[u8]> for Bound<'_, PyBytes>
impl PartialEq<[u8]> for Bound<'_, PyBytes>
Compares whether the Python bytes object is equal to the u8.
In some cases Python equality might be more appropriate; see the note on PyBytes.
source§impl PartialEq<Bound<'_, PyBytes>> for &[u8]
impl PartialEq<Bound<'_, PyBytes>> for &[u8]
Compares whether the Python bytes object is equal to the u8.
In some cases Python equality might be more appropriate; see the note on PyBytes.
source§impl PartialEq<Bound<'_, PyBytes>> for [u8]
impl PartialEq<Bound<'_, PyBytes>> for [u8]
Compares whether the Python bytes object is equal to the u8.
In some cases Python equality might be more appropriate; see the note on PyBytes.
source§impl PartialEq<Bound<'_, PyString>> for &str
impl PartialEq<Bound<'_, PyString>> for &str
Compares whether the data in the Python string is equal to the given UTF8.
In some cases Python equality might be more appropriate; see the note on PyString.
source§impl PartialEq<Bound<'_, PyString>> for str
impl PartialEq<Bound<'_, PyString>> for str
Compares whether the data in the Python string is equal to the given UTF8.
In some cases Python equality might be more appropriate; see the note on PyString.
source§impl PartialEq<str> for &Bound<'_, PyString>
impl PartialEq<str> for &Bound<'_, PyString>
Compares whether the data in the Python string is equal to the given UTF8.
In some cases Python equality might be more appropriate; see the note on PyString.
source§impl PartialEq<str> for Bound<'_, PyString>
impl PartialEq<str> for Bound<'_, PyString>
Compares whether the data in the Python string is equal to the given UTF8.
In some cases Python equality might be more appropriate; see the note on PyString.
source§impl<'py> PyAnyMethods<'py> for Bound<'py, PyAny>
impl<'py> PyAnyMethods<'py> for Bound<'py, PyAny>
source§fn add<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn add<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self + other.
source§fn sub<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn sub<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self - other.
source§fn mul<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn mul<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self * other.
source§fn matmul<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn matmul<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self @ other.
source§fn div<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn div<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self / other.
source§fn floor_div<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn floor_div<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self // other.
source§fn rem<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn rem<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self % other.
source§fn lshift<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn lshift<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self << other.
source§fn rshift<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn rshift<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self >> other.
source§fn bitand<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn bitand<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self & other.
source§fn bitor<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn bitor<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self | other.
source§fn bitxor<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn bitxor<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes self ^ other.
source§fn divmod<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn divmod<O>(&self, other: O) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
Computes divmod(self, other).
source§fn pow<O1, O2>(&self, other: O1, modulus: O2) -> PyResult<Bound<'py, PyAny>>where
O1: ToPyObject,
O2: ToPyObject,
fn pow<O1, O2>(&self, other: O1, modulus: O2) -> PyResult<Bound<'py, PyAny>>where
O1: ToPyObject,
O2: ToPyObject,
Computes self ** other % modulus (pow(self, other, modulus)).
py.None() may be passed for the modulus.
source§fn hasattr<N>(&self, attr_name: N) -> PyResult<bool>
fn hasattr<N>(&self, attr_name: N) -> PyResult<bool>
source§fn getattr<N>(&self, attr_name: N) -> PyResult<Bound<'py, PyAny>>
fn getattr<N>(&self, attr_name: N) -> PyResult<Bound<'py, PyAny>>
source§fn setattr<N, V>(&self, attr_name: N, value: V) -> PyResult<()>
fn setattr<N, V>(&self, attr_name: N, value: V) -> PyResult<()>
source§fn rich_compare<O>(
&self,
other: O,
compare_op: CompareOp,
) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
fn rich_compare<O>(
&self,
other: O,
compare_op: CompareOp,
) -> PyResult<Bound<'py, PyAny>>where
O: ToPyObject,
source§fn lt<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
fn lt<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
source§fn le<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
fn le<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
source§fn eq<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
fn eq<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
source§fn ne<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
fn ne<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
source§fn gt<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
fn gt<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
source§fn ge<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
fn ge<O>(&self, other: O) -> PyResult<bool>where
O: ToPyObject,
source§fn is_callable(&self) -> bool
fn is_callable(&self) -> bool
source§fn call(
&self,
args: impl IntoPy<Py<PyTuple>>,
kwargs: Option<&Bound<'_, PyDict>>,
) -> PyResult<Bound<'py, PyAny>>
fn call( &self, args: impl IntoPy<Py<PyTuple>>, kwargs: Option<&Bound<'_, PyDict>>, ) -> PyResult<Bound<'py, PyAny>>
source§fn call1(&self, args: impl IntoPy<Py<PyTuple>>) -> PyResult<Bound<'py, PyAny>>
fn call1(&self, args: impl IntoPy<Py<PyTuple>>) -> PyResult<Bound<'py, PyAny>>
source§fn call_method<N, A>(
&self,
name: N,
args: A,
kwargs: Option<&Bound<'_, PyDict>>,
) -> PyResult<Bound<'py, PyAny>>
fn call_method<N, A>( &self, name: N, args: A, kwargs: Option<&Bound<'_, PyDict>>, ) -> PyResult<Bound<'py, PyAny>>
source§fn call_method0<N>(&self, name: N) -> PyResult<Bound<'py, PyAny>>
fn call_method0<N>(&self, name: N) -> PyResult<Bound<'py, PyAny>>
source§fn call_method1<N, A>(&self, name: N, args: A) -> PyResult<Bound<'py, PyAny>>
fn call_method1<N, A>(&self, name: N, args: A) -> PyResult<Bound<'py, PyAny>>
source§fn is_truthy(&self) -> PyResult<bool>
fn is_truthy(&self) -> PyResult<bool>
source§fn is_ellipsis(&self) -> bool
fn is_ellipsis(&self) -> bool
.... Read moresource§fn is_empty(&self) -> PyResult<bool>
fn is_empty(&self) -> PyResult<bool>
source§fn get_item<K>(&self, key: K) -> PyResult<Bound<'py, PyAny>>where
K: ToPyObject,
fn get_item<K>(&self, key: K) -> PyResult<Bound<'py, PyAny>>where
K: ToPyObject,
source§fn set_item<K, V>(&self, key: K, value: V) -> PyResult<()>where
K: ToPyObject,
V: ToPyObject,
fn set_item<K, V>(&self, key: K, value: V) -> PyResult<()>where
K: ToPyObject,
V: ToPyObject,
source§fn del_item<K>(&self, key: K) -> PyResult<()>where
K: ToPyObject,
fn del_item<K>(&self, key: K) -> PyResult<()>where
K: ToPyObject,
source§fn iter(&self) -> PyResult<Bound<'py, PyIterator>>
fn iter(&self) -> PyResult<Bound<'py, PyIterator>>
source§fn get_type(&self) -> Bound<'py, PyType>
fn get_type(&self) -> Bound<'py, PyType>
source§fn get_type_ptr(&self) -> *mut PyTypeObject
fn get_type_ptr(&self) -> *mut PyTypeObject
source§fn downcast<T>(&self) -> Result<&Bound<'py, T>, DowncastError<'_, 'py>>where
T: PyTypeCheck,
fn downcast<T>(&self) -> Result<&Bound<'py, T>, DowncastError<'_, 'py>>where
T: PyTypeCheck,
PyAny to a concrete Python type or pyclass. Read moresource§fn downcast_into<T>(self) -> Result<Bound<'py, T>, DowncastIntoError<'py>>where
T: PyTypeCheck,
fn downcast_into<T>(self) -> Result<Bound<'py, T>, DowncastIntoError<'py>>where
T: PyTypeCheck,
source§fn downcast_exact<T>(&self) -> Result<&Bound<'py, T>, DowncastError<'_, 'py>>where
T: PyTypeInfo,
fn downcast_exact<T>(&self) -> Result<&Bound<'py, T>, DowncastError<'_, 'py>>where
T: PyTypeInfo,
PyAny to a concrete Python type or pyclass (but not a subclass of it). Read moresource§fn downcast_into_exact<T>(self) -> Result<Bound<'py, T>, DowncastIntoError<'py>>where
T: PyTypeInfo,
fn downcast_into_exact<T>(self) -> Result<Bound<'py, T>, DowncastIntoError<'py>>where
T: PyTypeInfo,
downcast_exact but takes ownership of self.source§unsafe fn downcast_unchecked<T>(&self) -> &Bound<'py, T>
unsafe fn downcast_unchecked<T>(&self) -> &Bound<'py, T>
PyAny to a concrete Python type without checking validity. Read moresource§unsafe fn downcast_into_unchecked<T>(self) -> Bound<'py, T>
unsafe fn downcast_into_unchecked<T>(self) -> Bound<'py, T>
source§fn extract<'a, T>(&'a self) -> PyResult<T>where
T: FromPyObjectBound<'a, 'py>,
fn extract<'a, T>(&'a self) -> PyResult<T>where
T: FromPyObjectBound<'a, 'py>,
source§fn get_refcnt(&self) -> isize
fn get_refcnt(&self) -> isize
source§fn repr(&self) -> PyResult<Bound<'py, PyString>>
fn repr(&self) -> PyResult<Bound<'py, PyString>>
source§fn str(&self) -> PyResult<Bound<'py, PyString>>
fn str(&self) -> PyResult<Bound<'py, PyString>>
source§fn dir(&self) -> PyResult<Bound<'py, PyList>>
fn dir(&self) -> PyResult<Bound<'py, PyList>>
source§fn is_instance(&self, ty: &Bound<'py, PyAny>) -> PyResult<bool>
fn is_instance(&self, ty: &Bound<'py, PyAny>) -> PyResult<bool>
ty. Read moresource§fn is_exact_instance(&self, ty: &Bound<'py, PyAny>) -> bool
fn is_exact_instance(&self, ty: &Bound<'py, PyAny>) -> bool
ty (not a subclass). Read moresource§fn is_instance_of<T: PyTypeInfo>(&self) -> bool
fn is_instance_of<T: PyTypeInfo>(&self) -> bool
T. Read moresource§fn is_exact_instance_of<T: PyTypeInfo>(&self) -> bool
fn is_exact_instance_of<T: PyTypeInfo>(&self) -> bool
T. Read moresource§impl<'py> PyBoolMethods<'py> for Bound<'py, PyBool>
impl<'py> PyBoolMethods<'py> for Bound<'py, PyBool>
source§impl<'py> PyByteArrayMethods<'py> for Bound<'py, PyByteArray>
impl<'py> PyByteArrayMethods<'py> for Bound<'py, PyByteArray>
source§fn data(&self) -> *mut u8
fn data(&self) -> *mut u8
source§unsafe fn as_bytes(&self) -> &[u8] ⓘ
unsafe fn as_bytes(&self) -> &[u8] ⓘ
ByteArray’s entire buffer. Read moresource§unsafe fn as_bytes_mut(&self) -> &mut [u8] ⓘ
unsafe fn as_bytes_mut(&self) -> &mut [u8] ⓘ
ByteArray’s entire buffer. Read moresource§impl<'py> PyBytesMethods<'py> for Bound<'py, PyBytes>
impl<'py> PyBytesMethods<'py> for Bound<'py, PyBytes>
source§impl<'py> PyCapsuleMethods<'py> for Bound<'py, PyCapsule>
impl<'py> PyCapsuleMethods<'py> for Bound<'py, PyCapsule>
source§fn set_context(&self, context: *mut c_void) -> PyResult<()>
fn set_context(&self, context: *mut c_void) -> PyResult<()>
source§fn context(&self) -> PyResult<*mut c_void>
fn context(&self) -> PyResult<*mut c_void>
source§unsafe fn reference<T>(&self) -> &'py T
unsafe fn reference<T>(&self) -> &'py T
source§impl<'py> PyComplexMethods<'py> for Bound<'py, PyComplex>
impl<'py> PyComplexMethods<'py> for Bound<'py, PyComplex>
source§impl PyDateAccess for Bound<'_, PyDate>
Available on non-Py_LIMITED_API only.
impl PyDateAccess for Bound<'_, PyDate>
Py_LIMITED_API only.source§impl PyDateAccess for Bound<'_, PyDateTime>
Available on non-Py_LIMITED_API only.
impl PyDateAccess for Bound<'_, PyDateTime>
Py_LIMITED_API only.source§impl PyDeltaAccess for Bound<'_, PyDelta>
Available on non-Py_LIMITED_API only.
impl PyDeltaAccess for Bound<'_, PyDelta>
Py_LIMITED_API only.source§fn get_days(&self) -> i32
fn get_days(&self) -> i32
source§fn get_seconds(&self) -> i32
fn get_seconds(&self) -> i32
source§fn get_microseconds(&self) -> i32
fn get_microseconds(&self) -> i32
source§impl<'py> PyDictMethods<'py> for Bound<'py, PyDict>
impl<'py> PyDictMethods<'py> for Bound<'py, PyDict>
source§fn copy(&self) -> PyResult<Bound<'py, PyDict>>
fn copy(&self) -> PyResult<Bound<'py, PyDict>>
source§fn contains<K>(&self, key: K) -> PyResult<bool>where
K: ToPyObject,
fn contains<K>(&self, key: K) -> PyResult<bool>where
K: ToPyObject,
source§fn get_item<K>(&self, key: K) -> PyResult<Option<Bound<'py, PyAny>>>where
K: ToPyObject,
fn get_item<K>(&self, key: K) -> PyResult<Option<Bound<'py, PyAny>>>where
K: ToPyObject,
source§fn set_item<K, V>(&self, key: K, value: V) -> PyResult<()>where
K: ToPyObject,
V: ToPyObject,
fn set_item<K, V>(&self, key: K, value: V) -> PyResult<()>where
K: ToPyObject,
V: ToPyObject,
source§fn iter(&self) -> BoundDictIterator<'py> ⓘ
fn iter(&self) -> BoundDictIterator<'py> ⓘ
(key, value) pairs in this dictionary. Read moresource§fn as_mapping(&self) -> &Bound<'py, PyMapping>
fn as_mapping(&self) -> &Bound<'py, PyMapping>
self cast as a PyMapping.source§fn into_mapping(self) -> Bound<'py, PyMapping>
fn into_mapping(self) -> Bound<'py, PyMapping>
self cast as a PyMapping.source§impl<'py> PyFloatMethods<'py> for Bound<'py, PyFloat>
impl<'py> PyFloatMethods<'py> for Bound<'py, PyFloat>
source§impl<'py> PyFrozenSetMethods<'py> for Bound<'py, PyFrozenSet>
impl<'py> PyFrozenSetMethods<'py> for Bound<'py, PyFrozenSet>
source§impl<'py> PyListMethods<'py> for Bound<'py, PyList>
impl<'py> PyListMethods<'py> for Bound<'py, PyList>
source§fn as_sequence(&self) -> &Bound<'py, PySequence>
fn as_sequence(&self) -> &Bound<'py, PySequence>
Returns self cast as a PySequence.
source§fn into_sequence(self) -> Bound<'py, PySequence>
fn into_sequence(self) -> Bound<'py, PySequence>
Returns self cast as a PySequence.
source§fn get_item(&self, index: usize) -> PyResult<Bound<'py, PyAny>>
fn get_item(&self, index: usize) -> PyResult<Bound<'py, PyAny>>
Gets the list item at the specified index.
§Example
use pyo3::{prelude::*, types::PyList};
Python::with_gil(|py| {
let list = PyList::new_bound(py, [2, 3, 5, 7]);
let obj = list.get_item(0);
assert_eq!(obj.unwrap().extract::<i32>().unwrap(), 2);
});source§unsafe fn get_item_unchecked(&self, index: usize) -> Bound<'py, PyAny>
Available on non-Py_LIMITED_API only.
unsafe fn get_item_unchecked(&self, index: usize) -> Bound<'py, PyAny>
Py_LIMITED_API only.Gets the list item at the specified index. Undefined behavior on bad index. Use with caution.
§Safety
Caller must verify that the index is within the bounds of the list.
source§fn get_slice(&self, low: usize, high: usize) -> Bound<'py, PyList>
fn get_slice(&self, low: usize, high: usize) -> Bound<'py, PyList>
Takes the slice self[low:high] and returns it as a new list.
Indices must be nonnegative, and out-of-range indices are clipped to
self.len().
source§fn set_item<I>(&self, index: usize, item: I) -> PyResult<()>where
I: ToPyObject,
fn set_item<I>(&self, index: usize, item: I) -> PyResult<()>where
I: ToPyObject,
Sets the item at the specified index.
Raises IndexError if the index is out of range.
source§fn del_item(&self, index: usize) -> PyResult<()>
fn del_item(&self, index: usize) -> PyResult<()>
Deletes the indexth element of self.
This is equivalent to the Python statement del self[i].
source§fn set_slice(
&self,
low: usize,
high: usize,
seq: &Bound<'_, PyAny>,
) -> PyResult<()>
fn set_slice( &self, low: usize, high: usize, seq: &Bound<'_, PyAny>, ) -> PyResult<()>
Assigns the sequence seq to the slice of self from low to high.
This is equivalent to the Python statement self[low:high] = v.
source§fn del_slice(&self, low: usize, high: usize) -> PyResult<()>
fn del_slice(&self, low: usize, high: usize) -> PyResult<()>
Deletes the slice from low to high from self.
This is equivalent to the Python statement del self[low:high].
source§fn insert<I>(&self, index: usize, item: I) -> PyResult<()>where
I: ToPyObject,
fn insert<I>(&self, index: usize, item: I) -> PyResult<()>where
I: ToPyObject,
Inserts an item at the specified index.
If index >= self.len(), inserts at the end.
source§fn contains<V>(&self, value: V) -> PyResult<bool>where
V: ToPyObject,
fn contains<V>(&self, value: V) -> PyResult<bool>where
V: ToPyObject,
Determines if self contains value.
This is equivalent to the Python expression value in self.
source§fn index<V>(&self, value: V) -> PyResult<usize>where
V: ToPyObject,
fn index<V>(&self, value: V) -> PyResult<usize>where
V: ToPyObject,
Returns the first index i for which self[i] == value.
This is equivalent to the Python expression self.index(value).
source§fn iter(&self) -> BoundListIterator<'py> ⓘ
fn iter(&self) -> BoundListIterator<'py> ⓘ
Returns an iterator over this list’s items.
source§fn sort(&self) -> PyResult<()>
fn sort(&self) -> PyResult<()>
Sorts the list in-place. Equivalent to the Python expression l.sort().
source§impl<'py> PyMappingMethods<'py> for Bound<'py, PyMapping>
impl<'py> PyMappingMethods<'py> for Bound<'py, PyMapping>
source§fn contains<K>(&self, key: K) -> PyResult<bool>where
K: ToPyObject,
fn contains<K>(&self, key: K) -> PyResult<bool>where
K: ToPyObject,
source§fn get_item<K>(&self, key: K) -> PyResult<Bound<'py, PyAny>>where
K: ToPyObject,
fn get_item<K>(&self, key: K) -> PyResult<Bound<'py, PyAny>>where
K: ToPyObject,
key. Read moresource§fn set_item<K, V>(&self, key: K, value: V) -> PyResult<()>where
K: ToPyObject,
V: ToPyObject,
fn set_item<K, V>(&self, key: K, value: V) -> PyResult<()>where
K: ToPyObject,
V: ToPyObject,
key. Read moresource§fn del_item<K>(&self, key: K) -> PyResult<()>where
K: ToPyObject,
fn del_item<K>(&self, key: K) -> PyResult<()>where
K: ToPyObject,
key. Read moresource§fn keys(&self) -> PyResult<Bound<'py, PySequence>>
fn keys(&self) -> PyResult<Bound<'py, PySequence>>
source§impl<'py> PyModuleMethods<'py> for Bound<'py, PyModule>
impl<'py> PyModuleMethods<'py> for Bound<'py, PyModule>
source§fn dict(&self) -> Bound<'py, PyDict>
fn dict(&self) -> Bound<'py, PyDict>
__dict__ attribute, which contains the module’s symbol table.source§fn index(&self) -> PyResult<Bound<'py, PyList>>
fn index(&self) -> PyResult<Bound<'py, PyList>>
__all__ attribute) of the module,
creating one if needed. Read moresource§fn name(&self) -> PyResult<Bound<'py, PyString>>
fn name(&self) -> PyResult<Bound<'py, PyString>>
__name__ attribute) of the module. Read moresource§fn filename(&self) -> PyResult<Bound<'py, PyString>>
fn filename(&self) -> PyResult<Bound<'py, PyString>>
__file__ attribute) of the module. Read moresource§fn add<N, V>(&self, name: N, value: V) -> PyResult<()>
fn add<N, V>(&self, name: N, value: V) -> PyResult<()>
source§fn add_class<T>(&self) -> PyResult<()>where
T: PyClass,
fn add_class<T>(&self) -> PyResult<()>where
T: PyClass,
source§fn add_wrapped<T>(&self, wrapper: &impl Fn(Python<'py>) -> T) -> PyResult<()>where
T: IntoPyCallbackOutput<PyObject>,
fn add_wrapped<T>(&self, wrapper: &impl Fn(Python<'py>) -> T) -> PyResult<()>where
T: IntoPyCallbackOutput<PyObject>,
source§fn add_submodule(&self, module: &Bound<'_, PyModule>) -> PyResult<()>
fn add_submodule(&self, module: &Bound<'_, PyModule>) -> PyResult<()>
source§fn add_function(&self, fun: Bound<'_, PyCFunction>) -> PyResult<()>
fn add_function(&self, fun: Bound<'_, PyCFunction>) -> PyResult<()>
source§impl<'py> PySequenceMethods<'py> for Bound<'py, PySequence>
impl<'py> PySequenceMethods<'py> for Bound<'py, PySequence>
source§fn concat(
&self,
other: &Bound<'_, PySequence>,
) -> PyResult<Bound<'py, PySequence>>
fn concat( &self, other: &Bound<'_, PySequence>, ) -> PyResult<Bound<'py, PySequence>>
source§fn repeat(&self, count: usize) -> PyResult<Bound<'py, PySequence>>
fn repeat(&self, count: usize) -> PyResult<Bound<'py, PySequence>>
count times. Read moresource§fn in_place_concat(
&self,
other: &Bound<'_, PySequence>,
) -> PyResult<Bound<'py, PySequence>>
fn in_place_concat( &self, other: &Bound<'_, PySequence>, ) -> PyResult<Bound<'py, PySequence>>
source§fn in_place_repeat(&self, count: usize) -> PyResult<Bound<'py, PySequence>>
fn in_place_repeat(&self, count: usize) -> PyResult<Bound<'py, PySequence>>
source§fn get_item(&self, index: usize) -> PyResult<Bound<'py, PyAny>>
fn get_item(&self, index: usize) -> PyResult<Bound<'py, PyAny>>
indexth element of the Sequence. Read moresource§fn count<V>(&self, value: V) -> PyResult<usize>where
V: ToPyObject,
fn count<V>(&self, value: V) -> PyResult<usize>where
V: ToPyObject,
PyPy only.value in self, that is, return the
number of keys for which self[key] == value.source§fn contains<V>(&self, value: V) -> PyResult<bool>where
V: ToPyObject,
fn contains<V>(&self, value: V) -> PyResult<bool>where
V: ToPyObject,
value. Read moresource§impl<'py> PySetMethods<'py> for Bound<'py, PySet>
impl<'py> PySetMethods<'py> for Bound<'py, PySet>
source§fn contains<K>(&self, key: K) -> PyResult<bool>where
K: ToPyObject,
fn contains<K>(&self, key: K) -> PyResult<bool>where
K: ToPyObject,
source§fn discard<K>(&self, key: K) -> PyResult<bool>where
K: ToPyObject,
fn discard<K>(&self, key: K) -> PyResult<bool>where
K: ToPyObject,
source§fn pop(&self) -> Option<Bound<'py, PyAny>>
fn pop(&self) -> Option<Bound<'py, PyAny>>
source§impl<'py> PySliceMethods<'py> for Bound<'py, PySlice>
impl<'py> PySliceMethods<'py> for Bound<'py, PySlice>
source§impl<'py> PyStringMethods<'py> for Bound<'py, PyString>
impl<'py> PyStringMethods<'py> for Bound<'py, PyString>
source§fn to_str(&self) -> PyResult<&str>
fn to_str(&self) -> PyResult<&str>
Py_3_10 or non-Py_LIMITED_API only.source§fn to_cow(&self) -> PyResult<Cow<'_, str>>
fn to_cow(&self) -> PyResult<Cow<'_, str>>
PyString into a Rust string, avoiding copying when possible. Read moresource§impl PyTimeAccess for Bound<'_, PyDateTime>
Available on non-Py_LIMITED_API only.
impl PyTimeAccess for Bound<'_, PyDateTime>
Py_LIMITED_API only.source§fn get_minute(&self) -> u8
fn get_minute(&self) -> u8
source§fn get_second(&self) -> u8
fn get_second(&self) -> u8
source§fn get_microsecond(&self) -> u32
fn get_microsecond(&self) -> u32
source§impl PyTimeAccess for Bound<'_, PyTime>
Available on non-Py_LIMITED_API only.
impl PyTimeAccess for Bound<'_, PyTime>
Py_LIMITED_API only.source§fn get_minute(&self) -> u8
fn get_minute(&self) -> u8
source§fn get_second(&self) -> u8
fn get_second(&self) -> u8
source§fn get_microsecond(&self) -> u32
fn get_microsecond(&self) -> u32
source§impl<'py> PyTracebackMethods<'py> for Bound<'py, PyTraceback>
impl<'py> PyTracebackMethods<'py> for Bound<'py, PyTraceback>
source§impl<'py> PyTupleMethods<'py> for Bound<'py, PyTuple>
impl<'py> PyTupleMethods<'py> for Bound<'py, PyTuple>
source§fn as_sequence(&self) -> &Bound<'py, PySequence>
fn as_sequence(&self) -> &Bound<'py, PySequence>
self cast as a PySequence.source§fn into_sequence(self) -> Bound<'py, PySequence>
fn into_sequence(self) -> Bound<'py, PySequence>
self cast as a PySequence.source§fn get_slice(&self, low: usize, high: usize) -> Bound<'py, PyTuple>
fn get_slice(&self, low: usize, high: usize) -> Bound<'py, PyTuple>
self[low:high] and returns it as a new tuple. Read moresource§fn get_item(&self, index: usize) -> PyResult<Bound<'py, PyAny>>
fn get_item(&self, index: usize) -> PyResult<Bound<'py, PyAny>>
source§fn get_borrowed_item<'a>(
&'a self,
index: usize,
) -> PyResult<Borrowed<'a, 'py, PyAny>>
fn get_borrowed_item<'a>( &'a self, index: usize, ) -> PyResult<Borrowed<'a, 'py, PyAny>>
get_item, but returns a borrowed object, which is a slight performance optimization
by avoiding a reference count change.source§unsafe fn get_item_unchecked(&self, index: usize) -> Bound<'py, PyAny>
unsafe fn get_item_unchecked(&self, index: usize) -> Bound<'py, PyAny>
Py_LIMITED_API nor PyPy nor GraalPy.source§unsafe fn get_borrowed_item_unchecked<'a>(
&'a self,
index: usize,
) -> Borrowed<'a, 'py, PyAny>
unsafe fn get_borrowed_item_unchecked<'a>( &'a self, index: usize, ) -> Borrowed<'a, 'py, PyAny>
Py_LIMITED_API nor PyPy nor GraalPy.get_item_unchecked, but returns a borrowed object,
which is a slight performance optimization by avoiding a reference count change. Read moresource§fn as_slice(&self) -> &[Bound<'py, PyAny>]
fn as_slice(&self) -> &[Bound<'py, PyAny>]
Py_LIMITED_API nor GraalPy.self as a slice of objects.source§fn contains<V>(&self, value: V) -> PyResult<bool>where
V: ToPyObject,
fn contains<V>(&self, value: V) -> PyResult<bool>where
V: ToPyObject,
value. Read moresource§fn iter(&self) -> BoundTupleIterator<'py> ⓘ
fn iter(&self) -> BoundTupleIterator<'py> ⓘ
source§fn iter_borrowed<'a>(&'a self) -> BorrowedTupleIterator<'a, 'py> ⓘ
fn iter_borrowed<'a>(&'a self) -> BorrowedTupleIterator<'a, 'py> ⓘ
iter, but produces an iterator which returns borrowed objects,
which is a slight performance optimization by avoiding a reference count change.source§impl<'py> PyTypeMethods<'py> for Bound<'py, PyType>
impl<'py> PyTypeMethods<'py> for Bound<'py, PyType>
source§fn as_type_ptr(&self) -> *mut PyTypeObject
fn as_type_ptr(&self) -> *mut PyTypeObject
Retrieves the underlying FFI pointer associated with this Python object.
source§fn module(&self) -> PyResult<Bound<'py, PyString>>
fn module(&self) -> PyResult<Bound<'py, PyString>>
Gets the name of the module defining the PyType.
source§fn fully_qualified_name(&self) -> PyResult<Bound<'py, PyString>>
fn fully_qualified_name(&self) -> PyResult<Bound<'py, PyString>>
Gets the fully qualified name of the PyType.
source§fn is_subclass(&self, other: &Bound<'_, PyAny>) -> PyResult<bool>
fn is_subclass(&self, other: &Bound<'_, PyAny>) -> PyResult<bool>
Checks whether self is a subclass of other.
Equivalent to the Python expression issubclass(self, other).
source§fn is_subclass_of<T>(&self) -> PyResult<bool>where
T: PyTypeInfo,
fn is_subclass_of<T>(&self) -> PyResult<bool>where
T: PyTypeInfo,
Checks whether self is a subclass of type T.
Equivalent to the Python expression issubclass(self, T), if the type
T is known at compile time.
source§impl<'py> PyTzInfoAccess<'py> for Bound<'py, PyDateTime>
Available on non-Py_LIMITED_API only.
impl<'py> PyTzInfoAccess<'py> for Bound<'py, PyDateTime>
Py_LIMITED_API only.source§fn get_tzinfo_bound(&self) -> Option<Bound<'py, PyTzInfo>>
fn get_tzinfo_bound(&self) -> Option<Bound<'py, PyTzInfo>>
source§fn get_tzinfo(&self) -> Option<&'py PyTzInfo>
fn get_tzinfo(&self) -> Option<&'py PyTzInfo>
get_tzinfo will be replaced by get_tzinfo_bound in a future PyO3 versiongil-refs only.get_tzinfo_bound.source§impl<'py> PyTzInfoAccess<'py> for Bound<'py, PyTime>
Available on non-Py_LIMITED_API only.
impl<'py> PyTzInfoAccess<'py> for Bound<'py, PyTime>
Py_LIMITED_API only.source§fn get_tzinfo_bound(&self) -> Option<Bound<'py, PyTzInfo>>
fn get_tzinfo_bound(&self) -> Option<Bound<'py, PyTzInfo>>
source§fn get_tzinfo(&self) -> Option<&'py PyTzInfo>
fn get_tzinfo(&self) -> Option<&'py PyTzInfo>
get_tzinfo will be replaced by get_tzinfo_bound in a future PyO3 versiongil-refs only.get_tzinfo_bound.source§impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakref>
impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakref>
source§fn get_object_borrowed(&self) -> Borrowed<'_, 'py, PyAny>
fn get_object_borrowed(&self) -> Borrowed<'_, 'py, PyAny>
source§fn upgrade_as<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeCheck,
fn upgrade_as<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeCheck,
source§fn upgrade_borrowed_as<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeCheck,
'py: 'a,
fn upgrade_borrowed_as<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeCheck,
'py: 'a,
source§unsafe fn upgrade_as_unchecked<T>(&self) -> Option<Bound<'py, T>>
unsafe fn upgrade_as_unchecked<T>(&self) -> Option<Bound<'py, T>>
weakref may still return None. Read moresource§unsafe fn upgrade_borrowed_as_unchecked<'a, T>(
&'a self,
) -> Option<Borrowed<'a, 'py, T>>where
'py: 'a,
unsafe fn upgrade_borrowed_as_unchecked<'a, T>(
&'a self,
) -> Option<Borrowed<'a, 'py, T>>where
'py: 'a,
weakref may still return None. Read moresource§fn upgrade_as_exact<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeInfo,
fn upgrade_as_exact<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeInfo,
source§fn upgrade_borrowed_as_exact<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeInfo,
'py: 'a,
fn upgrade_borrowed_as_exact<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeInfo,
'py: 'a,
source§impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakrefProxy>
impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakrefProxy>
source§fn get_object_borrowed(&self) -> Borrowed<'_, 'py, PyAny>
fn get_object_borrowed(&self) -> Borrowed<'_, 'py, PyAny>
source§fn upgrade_as<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeCheck,
fn upgrade_as<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeCheck,
source§fn upgrade_borrowed_as<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeCheck,
'py: 'a,
fn upgrade_borrowed_as<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeCheck,
'py: 'a,
source§unsafe fn upgrade_as_unchecked<T>(&self) -> Option<Bound<'py, T>>
unsafe fn upgrade_as_unchecked<T>(&self) -> Option<Bound<'py, T>>
weakref may still return None. Read moresource§unsafe fn upgrade_borrowed_as_unchecked<'a, T>(
&'a self,
) -> Option<Borrowed<'a, 'py, T>>where
'py: 'a,
unsafe fn upgrade_borrowed_as_unchecked<'a, T>(
&'a self,
) -> Option<Borrowed<'a, 'py, T>>where
'py: 'a,
weakref may still return None. Read moresource§fn upgrade_as_exact<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeInfo,
fn upgrade_as_exact<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeInfo,
source§fn upgrade_borrowed_as_exact<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeInfo,
'py: 'a,
fn upgrade_borrowed_as_exact<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeInfo,
'py: 'a,
source§impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakrefReference>
impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakrefReference>
source§fn get_object_borrowed(&self) -> Borrowed<'_, 'py, PyAny>
fn get_object_borrowed(&self) -> Borrowed<'_, 'py, PyAny>
source§fn upgrade_as<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeCheck,
fn upgrade_as<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeCheck,
source§fn upgrade_borrowed_as<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeCheck,
'py: 'a,
fn upgrade_borrowed_as<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeCheck,
'py: 'a,
source§unsafe fn upgrade_as_unchecked<T>(&self) -> Option<Bound<'py, T>>
unsafe fn upgrade_as_unchecked<T>(&self) -> Option<Bound<'py, T>>
weakref may still return None. Read moresource§unsafe fn upgrade_borrowed_as_unchecked<'a, T>(
&'a self,
) -> Option<Borrowed<'a, 'py, T>>where
'py: 'a,
unsafe fn upgrade_borrowed_as_unchecked<'a, T>(
&'a self,
) -> Option<Borrowed<'a, 'py, T>>where
'py: 'a,
weakref may still return None. Read moresource§fn upgrade_as_exact<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeInfo,
fn upgrade_as_exact<T>(&self) -> PyResult<Option<Bound<'py, T>>>where
T: PyTypeInfo,
source§fn upgrade_borrowed_as_exact<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeInfo,
'py: 'a,
fn upgrade_borrowed_as_exact<'a, T>(
&'a self,
) -> PyResult<Option<Borrowed<'a, 'py, T>>>where
T: PyTypeInfo,
'py: 'a,
source§impl<'py> Sub<&Bound<'py, PyComplex>> for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Sub<&Bound<'py, PyComplex>> for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Sub<Bound<'py, PyComplex>> for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Sub<Bound<'py, PyComplex>> for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Sub for &Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Sub for &Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<'py> Sub for Bound<'py, PyComplex>
Available on neither Py_LIMITED_API nor PyPy nor GraalPy.
impl<'py> Sub for Bound<'py, PyComplex>
Py_LIMITED_API nor PyPy nor GraalPy.source§impl<T> ToPyObject for Bound<'_, T>
impl<T> ToPyObject for Bound<'_, T>
Auto Trait Implementations§
impl<'py, T> Freeze for Bound<'py, T>
impl<'py, T> RefUnwindSafe for Bound<'py, T>where
T: RefUnwindSafe,
impl<'py, T> !Send for Bound<'py, T>
impl<'py, T> !Sync for Bound<'py, T>
impl<'py, T> Unpin for Bound<'py, T>where
T: Unpin,
impl<'py, T> UnwindSafe for Bound<'py, T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<I> IntoIterator for Iwhere
I: Iterator,
impl<I> IntoIterator for Iwhere
I: Iterator,
source§impl<T, I> IntoPyDict for Iwhere
T: PyDictItem,
I: IntoIterator<Item = T>,
impl<T, I> IntoPyDict for Iwhere
T: PyDictItem,
I: IntoIterator<Item = T>,
source§fn into_py_dict_bound(self, py: Python<'_>) -> Bound<'_, PyDict>
fn into_py_dict_bound(self, py: Python<'_>) -> Bound<'_, PyDict>
PyDict object pointer. Whether pointer owned or borrowed
depends on implementation.source§fn into_py_dict(self, py: Python<'_>) -> &PyDict
fn into_py_dict(self, py: Python<'_>) -> &PyDict
IntoPyDict::into_py_dict will be replaced by IntoPyDict::into_py_dict_bound in a future PyO3 versiongil-refs only.PyDict object pointer. Whether pointer owned or borrowed
depends on implementation.