Struct Bound
pub struct Bound<'py, T>(/* private fields */);tls only.Expand description
A Python thread-attached equivalent to Py<T>.
This type can be thought of as equivalent to the tuple (Py<T>, Python<'py>). By having the 'py
lifetime of the Python<'py> token, this ties the lifetime of the Bound<'py, T> smart pointer
to the lifetime the thread is attached to the Python interpreter and allows PyO3 to call Python APIs
at maximum efficiency.
To access the object in situations where the thread is not attached, convert it to Py<T>
using .unbind(). This includes, for example, usage in
Python::detach’s closure.
See the guide for more detail.
Implementations§
§impl<'py, T> Bound<'py, T>where
T: PyClass,
impl<'py, T> Bound<'py, T>where
T: PyClass,
pub fn new(
py: Python<'py>,
value: impl Into<PyClassInitializer<T>>,
) -> Result<Bound<'py, T>, PyErr>
pub fn new( py: Python<'py>, value: impl Into<PyClassInitializer<T>>, ) -> Result<Bound<'py, T>, PyErr>
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::attach(|py| -> PyResult<_> {
let foo: Bound<'_, Foo> = Bound::new(py, Foo {})?;
Ok(foo.into())
})?;§impl<'py, T> Bound<'py, T>
impl<'py, T> Bound<'py, T>
pub fn cast<U>(&self) -> Result<&Bound<'py, U>, CastError<'_, 'py>>where
U: PyTypeCheck,
pub fn cast<U>(&self) -> Result<&Bound<'py, U>, CastError<'_, 'py>>where
U: PyTypeCheck,
Cast this to a concrete Python type or pyclass.
Note that you can often avoid casting yourself by just specifying the desired type in function or method signatures. However, manual casting is sometimes necessary.
For extracting a Rust-only type, see extract.
This performs a runtime type check using the equivalent of Python’s
isinstance(self, U).
§Example: Casting to a specific Python object
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyList};
Python::attach(|py| {
let dict = PyDict::new(py);
assert!(dict.is_instance_of::<PyAny>());
let any = dict.as_any();
assert!(any.cast::<PyDict>().is_ok());
assert!(any.cast::<PyList>().is_err());
});§Example: Getting a reference to a pyclass
This is useful if you want to mutate a Py<PyAny> that might actually be a pyclass.
use pyo3::prelude::*;
#[pyclass]
struct Class {
i: i32,
}
Python::attach(|py| {
let class = Bound::new(py, Class { i: 0 })?.into_any();
let class_bound: &Bound<'_, Class> = class.cast()?;
class_bound.borrow_mut().i += 1;
// Alternatively you can get a `PyRefMut` directly
let class_ref: PyRefMut<'_, Class> = class.extract()?;
assert_eq!(class_ref.i, 1);
Ok(())
})pub fn cast_into<U>(self) -> Result<Bound<'py, U>, CastIntoError<'py>>where
U: PyTypeCheck,
pub fn cast_into<U>(self) -> Result<Bound<'py, U>, CastIntoError<'py>>where
U: PyTypeCheck,
Like cast but takes ownership of self.
In case of an error, it is possible to retrieve self again via
CastIntoError::into_inner.
§Example
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyList};
Python::attach(|py| {
let obj: Bound<'_, PyAny> = PyDict::new(py).into_any();
let obj: Bound<'_, PyAny> = match obj.cast_into::<PyList>() {
Ok(_) => panic!("obj should not be a list"),
Err(err) => err.into_inner(),
};
// obj is a dictionary
assert!(obj.cast_into::<PyDict>().is_ok());
})pub fn cast_exact<U>(&self) -> Result<&Bound<'py, U>, CastError<'_, 'py>>where
U: PyTypeInfo,
pub fn cast_exact<U>(&self) -> Result<&Bound<'py, U>, CastError<'_, 'py>>where
U: PyTypeInfo,
Cast this to a concrete Python type or pyclass (but not a subclass of it).
It is almost always better to use cast because it accounts for Python
subtyping. Use this method only when you do not want to allow subtypes.
The advantage of this method over cast is that it is faster. The
implementation of cast_exact uses the equivalent of the Python expression type(self) is U, whereas cast uses isinstance(self, U).
For extracting a Rust-only type, see extract.
§Example: Casting to a specific Python object but not a subtype
use pyo3::prelude::*;
use pyo3::types::{PyBool, PyInt};
Python::attach(|py| {
let b = PyBool::new(py, true);
assert!(b.is_instance_of::<PyBool>());
let any: &Bound<'_, PyAny> = b.as_any();
// `bool` is a subtype of `int`, so `cast` will accept a `bool` as an `int`
// but `cast_exact` will not.
assert!(any.cast::<PyInt>().is_ok());
assert!(any.cast_exact::<PyInt>().is_err());
assert!(any.cast_exact::<PyBool>().is_ok());
});pub fn cast_into_exact<U>(self) -> Result<Bound<'py, U>, CastIntoError<'py>>where
U: PyTypeInfo,
pub fn cast_into_exact<U>(self) -> Result<Bound<'py, U>, CastIntoError<'py>>where
U: PyTypeInfo,
Like cast_exact but takes ownership of self.
pub unsafe fn cast_unchecked<U>(&self) -> &Bound<'py, U>
pub unsafe fn cast_unchecked<U>(&self) -> &Bound<'py, U>
Converts this to a concrete Python type without checking validity.
§Safety
Callers must ensure that the type is valid or risk type confusion.
pub unsafe fn cast_into_unchecked<U>(self) -> Bound<'py, U>
pub unsafe fn cast_into_unchecked<U>(self) -> Bound<'py, U>
Like cast_unchecked but takes ownership of self.
§Safety
Callers must ensure that the type is valid or risk type confusion.
§impl<'py> Bound<'py, PyAny>
impl<'py> Bound<'py, PyAny>
pub unsafe fn from_owned_ptr_or_opt(
py: Python<'py>,
ptr: *mut PyObject,
) -> Option<Bound<'py, PyAny>>
pub unsafe fn from_owned_ptr_or_opt( py: Python<'py>, ptr: *mut PyObject, ) -> Option<Bound<'py, PyAny>>
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
pub unsafe fn from_owned_ptr_or_err(
py: Python<'py>,
ptr: *mut PyObject,
) -> Result<Bound<'py, PyAny>, PyErr>
pub unsafe fn from_owned_ptr_or_err( py: Python<'py>, ptr: *mut PyObject, ) -> Result<Bound<'py, PyAny>, PyErr>
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
pub unsafe fn from_borrowed_ptr_or_opt(
py: Python<'py>,
ptr: *mut PyObject,
) -> Option<Bound<'py, PyAny>>
pub unsafe fn from_borrowed_ptr_or_opt( py: Python<'py>, ptr: *mut PyObject, ) -> Option<Bound<'py, PyAny>>
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
pub unsafe fn from_borrowed_ptr_or_err(
py: Python<'py>,
ptr: *mut PyObject,
) -> Result<Bound<'py, PyAny>, PyErr>
pub unsafe fn from_borrowed_ptr_or_err( py: Python<'py>, ptr: *mut PyObject, ) -> Result<Bound<'py, PyAny>, PyErr>
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
§impl<'py, T> Bound<'py, T>where
T: PyClass,
impl<'py, T> Bound<'py, T>where
T: PyClass,
pub 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::attach(|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.
pub 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::attach(|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.
pub fn try_borrow(&self) -> Result<PyRef<'py, T>, PyBorrowError>
pub fn try_borrow(&self) -> Result<PyRef<'py, T>, PyBorrowError>
pub 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.
pub fn get(&self) -> &T
pub fn get(&self) -> &T
Provide an immutable borrow of the value T.
This is available if the class is frozen and Sync.
§Examples
use std::sync::atomic::{AtomicUsize, Ordering};
#[pyclass(frozen)]
struct FrozenCounter {
value: AtomicUsize,
}
Python::attach(|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);
});pub fn as_super(&self) -> &Bound<'py, <T as PyClassImpl>::BaseType>
pub fn as_super(&self) -> &Bound<'py, <T as PyClassImpl>::BaseType>
Upcast this Bound<PyClass> to its base type by reference.
If this type defined an explicit base class in its pyclass declaration
(e.g. #[pyclass(extends = BaseType)]), the returned type will be
&Bound<BaseType>. If an explicit base class was not declared, the
return value will be &Bound<PyAny> (making this method equivalent
to as_any).
This method is particularly useful for calling methods defined in an
extension trait that has been implemented for Bound<BaseType>.
See also the into_super method to upcast by value, and the
PyRef::as_super/PyRefMut::as_super methods for upcasting a pyclass
that has already been borrowed.
§Example: Calling a method defined on the Bound base type
use pyo3::prelude::*;
#[pyclass(subclass)]
struct BaseClass;
trait MyClassMethods<'py> {
fn pyrepr(&self) -> PyResult<String>;
}
impl<'py> MyClassMethods<'py> for Bound<'py, BaseClass> {
fn pyrepr(&self) -> PyResult<String> {
self.call_method0("__repr__")?.extract()
}
}
#[pyclass(extends = BaseClass)]
struct SubClass;
Python::attach(|py| {
let obj = Bound::new(py, (SubClass, BaseClass)).unwrap();
assert!(obj.as_super().pyrepr().is_ok());
})pub fn into_super(self) -> Bound<'py, <T as PyClassImpl>::BaseType>
pub fn into_super(self) -> Bound<'py, <T as PyClassImpl>::BaseType>
Upcast this Bound<PyClass> to its base type by value.
If this type defined an explicit base class in its pyclass declaration
(e.g. #[pyclass(extends = BaseType)]), the returned type will be
Bound<BaseType>. If an explicit base class was not declared, the
return value will be Bound<PyAny> (making this method equivalent
to into_any).
This method is particularly useful for calling methods defined in an
extension trait that has been implemented for Bound<BaseType>.
See also the as_super method to upcast by reference, and the
PyRef::into_super/PyRefMut::into_super methods for upcasting a pyclass
that has already been borrowed.
§Example: Calling a method defined on the Bound base type
use pyo3::prelude::*;
#[pyclass(subclass)]
struct BaseClass;
trait MyClassMethods<'py> {
fn pyrepr(self) -> PyResult<String>;
}
impl<'py> MyClassMethods<'py> for Bound<'py, BaseClass> {
fn pyrepr(self) -> PyResult<String> {
self.call_method0("__repr__")?.extract()
}
}
#[pyclass(extends = BaseClass)]
struct SubClass;
Python::attach(|py| {
let obj = Bound::new(py, (SubClass, BaseClass)).unwrap();
assert!(obj.into_super().pyrepr().is_ok());
})§impl<'py, T> Bound<'py, T>
impl<'py, T> Bound<'py, T>
pub 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.
pub 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).
pub fn into_any(self) -> Bound<'py, PyAny>
pub fn into_any(self) -> Bound<'py, PyAny>
Helper to cast to Bound<'py, PyAny>, transferring ownership.
pub 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.
pub fn unbind(self) -> Py<T>
pub fn unbind(self) -> Py<T>
Removes the connection for this Bound<T> from the Python<'py> token,
allowing it to cross thread boundaries.
pub fn as_unbound(&self) -> &Py<T>
pub fn as_unbound(&self) -> &Py<T>
Removes the connection for this Bound<T> from the Python<'py> token,
allowing it to cross thread boundaries, without transferring ownership.
§impl<'py> Bound<'py, PyIterator>
impl<'py> Bound<'py, PyIterator>
pub fn send(
&self,
value: &Bound<'py, PyAny>,
) -> Result<PySendResult<'py>, PyErr>
Available on non-PyPy and Py_3_10 only.
pub fn send( &self, value: &Bound<'py, PyAny>, ) -> Result<PySendResult<'py>, PyErr>
PyPy and Py_3_10 only.Sends a value into a python generator. This is the equivalent of calling
generator.send(value) in Python. This resumes the generator and continues its execution
until the next yield or return statement. When the generator completes, the (optional)
return value will be returned as PySendResult::Return. All subsequent calls will return
PySendResult::Return(None). The first call to send must be made with None as the
argument to start the generator, failing to do so will raise a TypeError.
Trait Implementations§
§impl<'py, T> BoundObject<'py, T> for Bound<'py, T>
impl<'py, T> BoundObject<'py, T> for Bound<'py, T>
§fn as_borrowed(&self) -> Borrowed<'_, 'py, T>
fn as_borrowed(&self) -> Borrowed<'_, 'py, T>
§fn into_bound(self) -> Bound<'py, T>
fn into_bound(self) -> Bound<'py, T>
Bound<'py, T>§impl<'py, T> Deref for Bound<'py, T>where
T: DerefToPyAny,
impl<'py, T> Deref for Bound<'py, T>where
T: DerefToPyAny,
§impl From<Bound<'_, PyByteArray>> for PyBackedBytes
impl From<Bound<'_, PyByteArray>> for PyBackedBytes
§fn from(py_bytearray: Bound<'_, PyByteArray>) -> PyBackedBytes
fn from(py_bytearray: Bound<'_, PyByteArray>) -> PyBackedBytes
§impl From<Bound<'_, PyBytes>> for PyBackedBytes
impl From<Bound<'_, PyBytes>> for PyBackedBytes
§fn from(py_bytes: Bound<'_, PyBytes>) -> PyBackedBytes
fn from(py_bytes: Bound<'_, PyBytes>) -> PyBackedBytes
§impl<'a, 'py, T> FromPyObject<'a, 'py> for Bound<'py, T>where
T: PyTypeCheck + 'a,
impl<'a, 'py, T> FromPyObject<'a, 'py> for Bound<'py, T>where
T: PyTypeCheck + 'a,
§impl<I> Index<I> for Bound<'_, PyBytes>where
I: SliceIndex<[u8]>,
This is the same way Vec is indexed.
impl<I> Index<I> for Bound<'_, PyBytes>where
I: SliceIndex<[u8]>,
This is the same way Vec is indexed.
§impl<'py> IntoIterator for &Bound<'py, PyDict>
impl<'py> IntoIterator for &Bound<'py, PyDict>
§impl<'py> IntoIterator for &Bound<'py, PyFrozenSet>
impl<'py> IntoIterator for &Bound<'py, PyFrozenSet>
§fn into_iter(self) -> <&Bound<'py, PyFrozenSet> as IntoIterator>::IntoIter ⓘ
fn into_iter(self) -> <&Bound<'py, PyFrozenSet> as IntoIterator>::IntoIter ⓘ
Returns an iterator of values in this set.
§type IntoIter = BoundFrozenSetIterator<'py>
type IntoIter = BoundFrozenSetIterator<'py>
§impl<'py> IntoIterator for &Bound<'py, PyIterator>
impl<'py> IntoIterator for &Bound<'py, PyIterator>
§impl<'py> IntoIterator for &Bound<'py, PyList>
impl<'py> IntoIterator for &Bound<'py, PyList>
§impl<'py> IntoIterator for &Bound<'py, PySet>
impl<'py> IntoIterator for &Bound<'py, PySet>
§impl<'py> IntoIterator for &Bound<'py, PyTuple>
impl<'py> IntoIterator for &Bound<'py, PyTuple>
§impl<'py> IntoIterator for Bound<'py, PyDict>
impl<'py> IntoIterator for Bound<'py, PyDict>
§impl<'py> IntoIterator for Bound<'py, PyFrozenSet>
impl<'py> IntoIterator for Bound<'py, PyFrozenSet>
§fn into_iter(self) -> <Bound<'py, PyFrozenSet> as IntoIterator>::IntoIter ⓘ
fn into_iter(self) -> <Bound<'py, PyFrozenSet> as IntoIterator>::IntoIter ⓘ
Returns an iterator of values in this set.
§type IntoIter = BoundFrozenSetIterator<'py>
type IntoIter = BoundFrozenSetIterator<'py>
§impl<'py> IntoIterator for Bound<'py, PyList>
impl<'py> IntoIterator for Bound<'py, PyList>
§impl<'py> IntoIterator for Bound<'py, PySet>
impl<'py> IntoIterator for Bound<'py, PySet>
§impl<'py> IntoIterator for Bound<'py, PyTuple>
impl<'py> IntoIterator for Bound<'py, PyTuple>
§impl<'a, 'py, T> IntoPyObject<'py> for &'a Bound<'py, T>where
T: PyTypeCheck,
impl<'a, 'py, T> IntoPyObject<'py> for &'a Bound<'py, T>where
T: PyTypeCheck,
§type Output = Borrowed<'a, 'py, <&'a Bound<'py, T> as IntoPyObject<'py>>::Target>
type Output = Borrowed<'a, 'py, <&'a Bound<'py, T> as IntoPyObject<'py>>::Target>
§type Error = Infallible
type Error = Infallible
§fn into_pyobject(
self,
_py: Python<'py>,
) -> Result<<&'a Bound<'py, T> as IntoPyObject<'py>>::Output, <&'a Bound<'py, T> as IntoPyObject<'py>>::Error>
fn into_pyobject( self, _py: Python<'py>, ) -> Result<<&'a Bound<'py, T> as IntoPyObject<'py>>::Output, <&'a Bound<'py, T> as IntoPyObject<'py>>::Error>
§impl<'py, T> IntoPyObject<'py> for Bound<'py, T>where
T: PyTypeCheck,
impl<'py, T> IntoPyObject<'py> for Bound<'py, T>where
T: PyTypeCheck,
§type Output = Bound<'py, <Bound<'py, T> as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <Bound<'py, T> as IntoPyObject<'py>>::Target>
§type Error = Infallible
type Error = Infallible
§fn into_pyobject(
self,
_py: Python<'py>,
) -> Result<<Bound<'py, T> as IntoPyObject<'py>>::Output, <Bound<'py, T> as IntoPyObject<'py>>::Error>
fn into_pyobject( self, _py: Python<'py>, ) -> Result<<Bound<'py, T> as IntoPyObject<'py>>::Output, <Bound<'py, T> as IntoPyObject<'py>>::Error>
§impl<'py> Iterator for Bound<'py, PyIterator>
impl<'py> Iterator for Bound<'py, PyIterator>
§fn next(&mut self) -> Option<<Bound<'py, PyIterator> as Iterator>::Item>
fn next(&mut self) -> Option<<Bound<'py, PyIterator> as Iterator>::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.
§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(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse)separator between items
of the original iterator. Read moreSource§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse)separator
between 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>
1.29.0 · Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
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,
Iterator. Read moreSource§fn try_collect<B>(
&mut self,
) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_collect<B>( &mut self, ) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect)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 partition_in_place<'a, T, P>(self, predicate: P) -> usize
fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
iter_partition_in_place)true precede all those that return false.
Returns the number of true elements found. Read moreSource§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.0.0 · Source§fn rposition<P>(&mut self, predicate: P) -> Option<usize>
fn rposition<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 · Source§fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 · Source§fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
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 rev(self) -> Rev<Self>where
Self: Sized + DoubleEndedIterator,
fn rev(self) -> Rev<Self>where
Self: Sized + DoubleEndedIterator,
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 more1.82.0 · Source§fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 · Source§fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 · Source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
§impl PartialEq<&[u8]> for Bound<'_, PyBytes>
Compares whether the Python bytes object is equal to the u8.
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.
§impl PartialEq<&Bound<'_, PyBytes>> for [u8]
Compares whether the Python bytes object is equal to the 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.
§impl PartialEq<&Bound<'_, PyString>> for str
Compares whether the data in the Python string is equal to the given UTF8.
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.
§impl PartialEq<&str> for Bound<'_, PyString>
Compares whether the data in the Python string is equal to the given UTF8.
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.
§impl PartialEq<[u8]> for &Bound<'_, PyBytes>
Compares whether the Python bytes object is equal to the u8.
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.
§impl PartialEq<[u8]> for Bound<'_, PyBytes>
Compares whether the Python bytes object is equal to the u8.
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.
§impl PartialEq<Bound<'_, PyBytes>> for &[u8]
Compares whether the Python bytes object is equal to the 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.
§impl PartialEq<Bound<'_, PyBytes>> for [u8]
Compares whether the Python bytes object is equal to the 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.
§impl PartialEq<Bound<'_, PyString>> for &str
Compares whether the data in the Python string is equal to the given UTF8.
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.
§impl PartialEq<Bound<'_, PyString>> for str
Compares whether the data in the Python string is equal to the given UTF8.
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.
§impl PartialEq<str> for &Bound<'_, PyString>
Compares whether the data in the Python string is equal to the given UTF8.
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.
§impl PartialEq<str> for Bound<'_, PyString>
Compares whether the data in the Python string is equal to the given UTF8.
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.
§impl<'py> PyAnyMethods<'py> for Bound<'py, PyAny>
impl<'py> PyAnyMethods<'py> for Bound<'py, PyAny>
§fn add<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn add<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self + other.
§fn sub<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn sub<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self - other.
§fn mul<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn mul<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self * other.
§fn matmul<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn matmul<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self @ other.
§fn div<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn div<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self / other.
§fn floor_div<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn floor_div<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self // other.
§fn rem<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn rem<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self % other.
§fn lshift<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn lshift<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self << other.
§fn rshift<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn rshift<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self >> other.
§fn bitand<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn bitand<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self & other.
§fn bitor<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn bitor<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self | other.
§fn bitxor<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn bitxor<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes self ^ other.
§fn divmod<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn divmod<O>(&self, other: O) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
Computes divmod(self, other).
§fn pow<O1, O2>(
&self,
other: O1,
modulus: O2,
) -> Result<Bound<'py, PyAny>, PyErr>where
O1: IntoPyObject<'py>,
O2: IntoPyObject<'py>,
fn pow<O1, O2>(
&self,
other: O1,
modulus: O2,
) -> Result<Bound<'py, PyAny>, PyErr>where
O1: IntoPyObject<'py>,
O2: IntoPyObject<'py>,
Computes self ** other % modulus (pow(self, other, modulus)).
py.None() may be passed for the modulus.
§fn hasattr<N>(&self, attr_name: N) -> Result<bool, PyErr>where
N: IntoPyObject<'py, Target = PyString>,
fn hasattr<N>(&self, attr_name: N) -> Result<bool, PyErr>where
N: IntoPyObject<'py, Target = PyString>,
§fn getattr<N>(&self, attr_name: N) -> Result<Bound<'py, PyAny>, PyErr>where
N: IntoPyObject<'py, Target = PyString>,
fn getattr<N>(&self, attr_name: N) -> Result<Bound<'py, PyAny>, PyErr>where
N: IntoPyObject<'py, Target = PyString>,
§fn getattr_opt<N>(
&self,
attr_name: N,
) -> Result<Option<Bound<'py, PyAny>>, PyErr>where
N: IntoPyObject<'py, Target = PyString>,
fn getattr_opt<N>(
&self,
attr_name: N,
) -> Result<Option<Bound<'py, PyAny>>, PyErr>where
N: IntoPyObject<'py, Target = PyString>,
§fn setattr<N, V>(&self, attr_name: N, value: V) -> Result<(), PyErr>
fn setattr<N, V>(&self, attr_name: N, value: V) -> Result<(), PyErr>
§fn delattr<N>(&self, attr_name: N) -> Result<(), PyErr>where
N: IntoPyObject<'py, Target = PyString>,
fn delattr<N>(&self, attr_name: N) -> Result<(), PyErr>where
N: IntoPyObject<'py, Target = PyString>,
§fn rich_compare<O>(
&self,
other: O,
compare_op: CompareOp,
) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
fn rich_compare<O>(
&self,
other: O,
compare_op: CompareOp,
) -> Result<Bound<'py, PyAny>, PyErr>where
O: IntoPyObject<'py>,
§fn lt<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
fn lt<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
§fn le<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
fn le<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
§fn eq<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
fn eq<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
§fn ne<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
fn ne<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
§fn gt<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
fn gt<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
§fn ge<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
fn ge<O>(&self, other: O) -> Result<bool, PyErr>where
O: IntoPyObject<'py>,
§fn is_callable(&self) -> bool
fn is_callable(&self) -> bool
§fn call<A>(
&self,
args: A,
kwargs: Option<&Bound<'py, PyDict>>,
) -> Result<Bound<'py, PyAny>, PyErr>where
A: PyCallArgs<'py>,
fn call<A>(
&self,
args: A,
kwargs: Option<&Bound<'py, PyDict>>,
) -> Result<Bound<'py, PyAny>, PyErr>where
A: PyCallArgs<'py>,
§fn call1<A>(&self, args: A) -> Result<Bound<'py, PyAny>, PyErr>where
A: PyCallArgs<'py>,
fn call1<A>(&self, args: A) -> Result<Bound<'py, PyAny>, PyErr>where
A: PyCallArgs<'py>,
§fn call_method<N, A>(
&self,
name: N,
args: A,
kwargs: Option<&Bound<'py, PyDict>>,
) -> Result<Bound<'py, PyAny>, PyErr>
fn call_method<N, A>( &self, name: N, args: A, kwargs: Option<&Bound<'py, PyDict>>, ) -> Result<Bound<'py, PyAny>, PyErr>
§fn call_method0<N>(&self, name: N) -> Result<Bound<'py, PyAny>, PyErr>where
N: IntoPyObject<'py, Target = PyString>,
fn call_method0<N>(&self, name: N) -> Result<Bound<'py, PyAny>, PyErr>where
N: IntoPyObject<'py, Target = PyString>,
§fn call_method1<N, A>(
&self,
name: N,
args: A,
) -> Result<Bound<'py, PyAny>, PyErr>
fn call_method1<N, A>( &self, name: N, args: A, ) -> Result<Bound<'py, PyAny>, PyErr>
§fn is_truthy(&self) -> Result<bool, PyErr>
fn is_truthy(&self) -> Result<bool, PyErr>
§fn is_empty(&self) -> Result<bool, PyErr>
fn is_empty(&self) -> Result<bool, PyErr>
§fn get_item<K>(&self, key: K) -> Result<Bound<'py, PyAny>, PyErr>where
K: IntoPyObject<'py>,
fn get_item<K>(&self, key: K) -> Result<Bound<'py, PyAny>, PyErr>where
K: IntoPyObject<'py>,
§fn set_item<K, V>(&self, key: K, value: V) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
V: IntoPyObject<'py>,
fn set_item<K, V>(&self, key: K, value: V) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
V: IntoPyObject<'py>,
§fn del_item<K>(&self, key: K) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
fn del_item<K>(&self, key: K) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
§fn try_iter(&self) -> Result<Bound<'py, PyIterator>, PyErr>
fn try_iter(&self) -> Result<Bound<'py, PyIterator>, PyErr>
§fn get_type_ptr(&self) -> *mut PyTypeObject
fn get_type_ptr(&self) -> *mut PyTypeObject
§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,
use Bound::cast instead
PyAny to a concrete Python type or pyclass. Read more§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,
use Bound::cast_into instead
§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,
use Bound::cast_exact instead
PyAny to a concrete Python type or pyclass (but not a subclass of it). Read more§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,
use Bound::cast_into_exact instead
downcast_exact but takes ownership of self.§unsafe fn downcast_unchecked<T>(&self) -> &Bound<'py, T>
unsafe fn downcast_unchecked<T>(&self) -> &Bound<'py, T>
use Bound::cast_unchecked instead
PyAny to a concrete Python type without checking validity. Read more§unsafe fn downcast_into_unchecked<T>(self) -> Bound<'py, T>
unsafe fn downcast_into_unchecked<T>(self) -> Bound<'py, T>
use Bound::cast_into_unchecked instead
§fn extract<'a, T>(&'a self) -> Result<T, <T as FromPyObject<'a, 'py>>::Error>where
T: FromPyObject<'a, 'py>,
fn extract<'a, T>(&'a self) -> Result<T, <T as FromPyObject<'a, 'py>>::Error>where
T: FromPyObject<'a, 'py>,
§fn get_refcnt(&self) -> isize
fn get_refcnt(&self) -> isize
§fn repr(&self) -> Result<Bound<'py, PyString>, PyErr>
fn repr(&self) -> Result<Bound<'py, PyString>, PyErr>
§fn str(&self) -> Result<Bound<'py, PyString>, PyErr>
fn str(&self) -> Result<Bound<'py, PyString>, PyErr>
§fn dir(&self) -> Result<Bound<'py, PyList>, PyErr>
fn dir(&self) -> Result<Bound<'py, PyList>, PyErr>
§fn is_instance(&self, ty: &Bound<'py, PyAny>) -> Result<bool, PyErr>
fn is_instance(&self, ty: &Bound<'py, PyAny>) -> Result<bool, PyErr>
ty. Read more§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 more§fn is_instance_of<T>(&self) -> boolwhere
T: PyTypeCheck,
fn is_instance_of<T>(&self) -> boolwhere
T: PyTypeCheck,
T. Read more§fn is_exact_instance_of<T>(&self) -> boolwhere
T: PyTypeInfo,
fn is_exact_instance_of<T>(&self) -> boolwhere
T: PyTypeInfo,
T. Read more§impl<'py> PyBoolMethods<'py> for Bound<'py, PyBool>
impl<'py> PyBoolMethods<'py> for Bound<'py, PyBool>
§impl<'py> PyByteArrayMethods<'py> for Bound<'py, PyByteArray>
impl<'py> PyByteArrayMethods<'py> for Bound<'py, PyByteArray>
§impl<'py> PyBytesMethods<'py> for Bound<'py, PyBytes>
impl<'py> PyBytesMethods<'py> for Bound<'py, PyBytes>
§impl<'py> PyCapsuleMethods<'py> for Bound<'py, PyCapsule>
impl<'py> PyCapsuleMethods<'py> for Bound<'py, PyCapsule>
§fn set_context(&self, context: *mut c_void) -> Result<(), PyErr>
fn set_context(&self, context: *mut c_void) -> Result<(), PyErr>
§fn context(&self) -> Result<*mut c_void, PyErr>
fn context(&self) -> Result<*mut c_void, PyErr>
§unsafe fn reference<T>(&self) -> &T
unsafe fn reference<T>(&self) -> &T
to be removed, see pointer_checked()
§fn pointer(&self) -> *mut c_void
fn pointer(&self) -> *mut c_void
use pointer_checked() instead
§fn pointer_checked(&self, name: Option<&CStr>) -> Result<NonNull<c_void>, PyErr>
fn pointer_checked(&self, name: Option<&CStr>) -> Result<NonNull<c_void>, PyErr>
§fn is_valid(&self) -> bool
fn is_valid(&self) -> bool
use is_valid_checked() instead
§fn is_valid_checked(&self, name: Option<&CStr>) -> bool
fn is_valid_checked(&self, name: Option<&CStr>) -> bool
name and that the pointer is not null.§impl<'py> PyCodeMethods<'py> for Bound<'py, PyCode>
impl<'py> PyCodeMethods<'py> for Bound<'py, PyCode>
§impl<'py> PyComplexMethods<'py> for Bound<'py, PyComplex>
impl<'py> PyComplexMethods<'py> for Bound<'py, PyComplex>
§impl PyDateAccess for Bound<'_, PyDate>
Available on non-Py_LIMITED_API only.
impl PyDateAccess for Bound<'_, PyDate>
Py_LIMITED_API only.§impl PyDateAccess for Bound<'_, PyDateTime>
Available on non-Py_LIMITED_API only.
impl PyDateAccess for Bound<'_, PyDateTime>
Py_LIMITED_API only.§impl PyDeltaAccess for Bound<'_, PyDelta>
Available on non-Py_LIMITED_API only.
impl PyDeltaAccess for Bound<'_, PyDelta>
Py_LIMITED_API only.§fn get_days(&self) -> i32
fn get_days(&self) -> i32
§fn get_seconds(&self) -> i32
fn get_seconds(&self) -> i32
§fn get_microseconds(&self) -> i32
fn get_microseconds(&self) -> i32
§impl<'py> PyDictMethods<'py> for Bound<'py, PyDict>
impl<'py> PyDictMethods<'py> for Bound<'py, PyDict>
§fn copy(&self) -> Result<Bound<'py, PyDict>, PyErr>
fn copy(&self) -> Result<Bound<'py, PyDict>, PyErr>
§fn contains<K>(&self, key: K) -> Result<bool, PyErr>where
K: IntoPyObject<'py>,
fn contains<K>(&self, key: K) -> Result<bool, PyErr>where
K: IntoPyObject<'py>,
§fn get_item<K>(&self, key: K) -> Result<Option<Bound<'py, PyAny>>, PyErr>where
K: IntoPyObject<'py>,
fn get_item<K>(&self, key: K) -> Result<Option<Bound<'py, PyAny>>, PyErr>where
K: IntoPyObject<'py>,
§fn set_item<K, V>(&self, key: K, value: V) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
V: IntoPyObject<'py>,
fn set_item<K, V>(&self, key: K, value: V) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
V: IntoPyObject<'py>,
§fn del_item<K>(&self, key: K) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
fn del_item<K>(&self, key: K) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
§fn iter(&self) -> BoundDictIterator<'py> ⓘ
fn iter(&self) -> BoundDictIterator<'py> ⓘ
(key, value) pairs in this dictionary. Read more§fn locked_for_each<F>(&self, f: F) -> Result<(), PyErr>
fn locked_for_each<F>(&self, f: F) -> Result<(), PyErr>
§fn as_mapping(&self) -> &Bound<'py, PyMapping>
fn as_mapping(&self) -> &Bound<'py, PyMapping>
self cast as a PyMapping.§fn into_mapping(self) -> Bound<'py, PyMapping>
fn into_mapping(self) -> Bound<'py, PyMapping>
self cast as a PyMapping.§impl<'py> PyFloatMethods<'py> for Bound<'py, PyFloat>
impl<'py> PyFloatMethods<'py> for Bound<'py, PyFloat>
§impl<'py> PyFrozenSetMethods<'py> for Bound<'py, PyFrozenSet>
impl<'py> PyFrozenSetMethods<'py> for Bound<'py, PyFrozenSet>
§impl<'py> PyListMethods<'py> for Bound<'py, PyList>
impl<'py> PyListMethods<'py> for Bound<'py, PyList>
§fn as_sequence(&self) -> &Bound<'py, PySequence>
fn as_sequence(&self) -> &Bound<'py, PySequence>
Returns self cast as a PySequence.
§fn into_sequence(self) -> Bound<'py, PySequence>
fn into_sequence(self) -> Bound<'py, PySequence>
Returns self cast as a PySequence.
§fn get_item(&self, index: usize) -> Result<Bound<'py, PyAny>, PyErr>
fn get_item(&self, index: usize) -> Result<Bound<'py, PyAny>, PyErr>
Gets the list item at the specified index.
§Example
use pyo3::{prelude::*, types::PyList};
Python::attach(|py| {
let list = PyList::new(py, [2, 3, 5, 7]).unwrap();
let obj = list.get_item(0);
assert_eq!(obj.unwrap().extract::<i32>().unwrap(), 2);
});§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.
§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().
§fn set_item<I>(&self, index: usize, item: I) -> Result<(), PyErr>where
I: IntoPyObject<'py>,
fn set_item<I>(&self, index: usize, item: I) -> Result<(), PyErr>where
I: IntoPyObject<'py>,
Sets the item at the specified index.
Raises IndexError if the index is out of range.
§fn del_item(&self, index: usize) -> Result<(), PyErr>
fn del_item(&self, index: usize) -> Result<(), PyErr>
Deletes the indexth element of self.
This is equivalent to the Python statement del self[i].
§fn set_slice(
&self,
low: usize,
high: usize,
seq: &Bound<'_, PyAny>,
) -> Result<(), PyErr>
fn set_slice( &self, low: usize, high: usize, seq: &Bound<'_, PyAny>, ) -> Result<(), PyErr>
Assigns the sequence seq to the slice of self from low to high.
This is equivalent to the Python statement self[low:high] = v.
§fn del_slice(&self, low: usize, high: usize) -> Result<(), PyErr>
fn del_slice(&self, low: usize, high: usize) -> Result<(), PyErr>
Deletes the slice from low to high from self.
This is equivalent to the Python statement del self[low:high].
§fn append<I>(&self, item: I) -> Result<(), PyErr>where
I: IntoPyObject<'py>,
fn append<I>(&self, item: I) -> Result<(), PyErr>where
I: IntoPyObject<'py>,
Appends an item to the list.
§fn insert<I>(&self, index: usize, item: I) -> Result<(), PyErr>where
I: IntoPyObject<'py>,
fn insert<I>(&self, index: usize, item: I) -> Result<(), PyErr>where
I: IntoPyObject<'py>,
Inserts an item at the specified index.
If index >= self.len(), inserts at the end.
§fn contains<V>(&self, value: V) -> Result<bool, PyErr>where
V: IntoPyObject<'py>,
fn contains<V>(&self, value: V) -> Result<bool, PyErr>where
V: IntoPyObject<'py>,
Determines if self contains value.
This is equivalent to the Python expression value in self.
§fn index<V>(&self, value: V) -> Result<usize, PyErr>where
V: IntoPyObject<'py>,
fn index<V>(&self, value: V) -> Result<usize, PyErr>where
V: IntoPyObject<'py>,
Returns the first index i for which self[i] == value.
This is equivalent to the Python expression self.index(value).
§fn iter(&self) -> BoundListIterator<'py> ⓘ
fn iter(&self) -> BoundListIterator<'py> ⓘ
Returns an iterator over this list’s items.
§fn locked_for_each<F>(&self, closure: F) -> Result<(), PyErr>
fn locked_for_each<F>(&self, closure: F) -> Result<(), PyErr>
Iterates over a list while holding a critical section, calling a closure on each item
§fn sort(&self) -> Result<(), PyErr>
fn sort(&self) -> Result<(), PyErr>
Sorts the list in-place. Equivalent to the Python expression l.sort().
§impl<'py> PyMappingMethods<'py> for Bound<'py, PyMapping>
impl<'py> PyMappingMethods<'py> for Bound<'py, PyMapping>
§fn contains<K>(&self, key: K) -> Result<bool, PyErr>where
K: IntoPyObject<'py>,
fn contains<K>(&self, key: K) -> Result<bool, PyErr>where
K: IntoPyObject<'py>,
§fn get_item<K>(&self, key: K) -> Result<Bound<'py, PyAny>, PyErr>where
K: IntoPyObject<'py>,
fn get_item<K>(&self, key: K) -> Result<Bound<'py, PyAny>, PyErr>where
K: IntoPyObject<'py>,
key. Read more§fn set_item<K, V>(&self, key: K, value: V) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
V: IntoPyObject<'py>,
fn set_item<K, V>(&self, key: K, value: V) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
V: IntoPyObject<'py>,
key. Read more§fn del_item<K>(&self, key: K) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
fn del_item<K>(&self, key: K) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
key. Read more§fn keys(&self) -> Result<Bound<'py, PyList>, PyErr>
fn keys(&self) -> Result<Bound<'py, PyList>, PyErr>
§impl<'py, 'a> PyMappingProxyMethods<'py, 'a> for Bound<'py, PyMappingProxy>
impl<'py, 'a> PyMappingProxyMethods<'py, 'a> for Bound<'py, PyMappingProxy>
§fn keys(&self) -> Result<Bound<'py, PyList>, PyErr>
fn keys(&self) -> Result<Bound<'py, PyList>, PyErr>
§fn values(&self) -> Result<Bound<'py, PyList>, PyErr>
fn values(&self) -> Result<Bound<'py, PyList>, PyErr>
§fn items(&self) -> Result<Bound<'py, PyList>, PyErr>
fn items(&self) -> Result<Bound<'py, PyList>, PyErr>
§fn as_mapping(&self) -> &Bound<'py, PyMapping>
fn as_mapping(&self) -> &Bound<'py, PyMapping>
self cast as a PyMapping.§impl<'py> PyModuleMethods<'py> for Bound<'py, PyModule>
impl<'py> PyModuleMethods<'py> for Bound<'py, PyModule>
§fn dict(&self) -> Bound<'py, PyDict>
fn dict(&self) -> Bound<'py, PyDict>
__dict__ attribute, which contains the module’s symbol table.§fn index(&self) -> Result<Bound<'py, PyList>, PyErr>
fn index(&self) -> Result<Bound<'py, PyList>, PyErr>
__all__ attribute) of the module,
creating one if needed. Read more§fn name(&self) -> Result<Bound<'py, PyString>, PyErr>
fn name(&self) -> Result<Bound<'py, PyString>, PyErr>
__name__ attribute) of the module. Read more§fn filename(&self) -> Result<Bound<'py, PyString>, PyErr>
fn filename(&self) -> Result<Bound<'py, PyString>, PyErr>
__file__ attribute) of the module. Read more§fn add<N, V>(&self, name: N, value: V) -> Result<(), PyErr>
fn add<N, V>(&self, name: N, value: V) -> Result<(), PyErr>
§fn add_class<T>(&self) -> Result<(), PyErr>where
T: PyClass,
fn add_class<T>(&self) -> Result<(), PyErr>where
T: PyClass,
§fn add_wrapped<T>(
&self,
wrapper: &impl Fn(Python<'py>) -> T,
) -> Result<(), PyErr>
fn add_wrapped<T>( &self, wrapper: &impl Fn(Python<'py>) -> T, ) -> Result<(), PyErr>
§fn add_submodule(&self, module: &Bound<'_, PyModule>) -> Result<(), PyErr>
fn add_submodule(&self, module: &Bound<'_, PyModule>) -> Result<(), PyErr>
§fn add_function(&self, fun: Bound<'_, PyCFunction>) -> Result<(), PyErr>
fn add_function(&self, fun: Bound<'_, PyCFunction>) -> Result<(), PyErr>
§impl<'py> PyRangeMethods<'py> for Bound<'py, PyRange>
impl<'py> PyRangeMethods<'py> for Bound<'py, PyRange>
§impl<'py> PySequenceMethods<'py> for Bound<'py, PySequence>
impl<'py> PySequenceMethods<'py> for Bound<'py, PySequence>
§fn concat(
&self,
other: &Bound<'_, PySequence>,
) -> Result<Bound<'py, PySequence>, PyErr>
fn concat( &self, other: &Bound<'_, PySequence>, ) -> Result<Bound<'py, PySequence>, PyErr>
§fn repeat(&self, count: usize) -> Result<Bound<'py, PySequence>, PyErr>
fn repeat(&self, count: usize) -> Result<Bound<'py, PySequence>, PyErr>
count times. Read more§fn in_place_concat(
&self,
other: &Bound<'_, PySequence>,
) -> Result<Bound<'py, PySequence>, PyErr>
fn in_place_concat( &self, other: &Bound<'_, PySequence>, ) -> Result<Bound<'py, PySequence>, PyErr>
§fn in_place_repeat(&self, count: usize) -> Result<Bound<'py, PySequence>, PyErr>
fn in_place_repeat(&self, count: usize) -> Result<Bound<'py, PySequence>, PyErr>
§fn get_item(&self, index: usize) -> Result<Bound<'py, PyAny>, PyErr>
fn get_item(&self, index: usize) -> Result<Bound<'py, PyAny>, PyErr>
indexth element of the Sequence. Read more§fn count<V>(&self, value: V) -> Result<usize, PyErr>where
V: IntoPyObject<'py>,
fn count<V>(&self, value: V) -> Result<usize, PyErr>where
V: IntoPyObject<'py>,
PyPy only.value in self, that is, return the
number of keys for which self[key] == value.§fn contains<V>(&self, value: V) -> Result<bool, PyErr>where
V: IntoPyObject<'py>,
fn contains<V>(&self, value: V) -> Result<bool, PyErr>where
V: IntoPyObject<'py>,
value. Read more§impl<'py> PySetMethods<'py> for Bound<'py, PySet>
impl<'py> PySetMethods<'py> for Bound<'py, PySet>
§fn contains<K>(&self, key: K) -> Result<bool, PyErr>where
K: IntoPyObject<'py>,
fn contains<K>(&self, key: K) -> Result<bool, PyErr>where
K: IntoPyObject<'py>,
§fn discard<K>(&self, key: K) -> Result<bool, PyErr>where
K: IntoPyObject<'py>,
fn discard<K>(&self, key: K) -> Result<bool, PyErr>where
K: IntoPyObject<'py>,
§fn add<K>(&self, key: K) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
fn add<K>(&self, key: K) -> Result<(), PyErr>where
K: IntoPyObject<'py>,
§fn iter(&self) -> BoundSetIterator<'py> ⓘ
fn iter(&self) -> BoundSetIterator<'py> ⓘ
§impl<'py> PySliceMethods<'py> for Bound<'py, PySlice>
impl<'py> PySliceMethods<'py> for Bound<'py, PySlice>
§impl<'py> PyStringMethods<'py> for Bound<'py, PyString>
impl<'py> PyStringMethods<'py> for Bound<'py, PyString>
§fn to_str(&self) -> Result<&str, PyErr>
fn to_str(&self) -> Result<&str, PyErr>
Py_3_10 or non-Py_LIMITED_API only.§fn to_cow(&self) -> Result<Cow<'_, str>, PyErr>
fn to_cow(&self) -> Result<Cow<'_, str>, PyErr>
PyString into a Rust string, avoiding copying when possible. Read more§fn to_string_lossy(&self) -> Cow<'_, str>
fn to_string_lossy(&self) -> Cow<'_, str>
PyString into a Rust string. Read more§impl PyTimeAccess for Bound<'_, PyDateTime>
Available on non-Py_LIMITED_API only.
impl PyTimeAccess for Bound<'_, PyDateTime>
Py_LIMITED_API only.§fn get_minute(&self) -> u8
fn get_minute(&self) -> u8
§fn get_second(&self) -> u8
fn get_second(&self) -> u8
§fn get_microsecond(&self) -> u32
fn get_microsecond(&self) -> u32
§impl PyTimeAccess for Bound<'_, PyTime>
Available on non-Py_LIMITED_API only.
impl PyTimeAccess for Bound<'_, PyTime>
Py_LIMITED_API only.§fn get_minute(&self) -> u8
fn get_minute(&self) -> u8
§fn get_second(&self) -> u8
fn get_second(&self) -> u8
§fn get_microsecond(&self) -> u32
fn get_microsecond(&self) -> u32
§impl<'py> PyTracebackMethods<'py> for Bound<'py, PyTraceback>
impl<'py> PyTracebackMethods<'py> for Bound<'py, PyTraceback>
§impl<'py> PyTupleMethods<'py> for Bound<'py, PyTuple>
impl<'py> PyTupleMethods<'py> for Bound<'py, PyTuple>
§fn as_sequence(&self) -> &Bound<'py, PySequence>
fn as_sequence(&self) -> &Bound<'py, PySequence>
self cast as a PySequence.§fn into_sequence(self) -> Bound<'py, PySequence>
fn into_sequence(self) -> Bound<'py, PySequence>
self cast as a PySequence.§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 more§fn get_item(&self, index: usize) -> Result<Bound<'py, PyAny>, PyErr>
fn get_item(&self, index: usize) -> Result<Bound<'py, PyAny>, PyErr>
§fn get_borrowed_item<'a>(
&'a self,
index: usize,
) -> Result<Borrowed<'a, 'py, PyAny>, PyErr>
fn get_borrowed_item<'a>( &'a self, index: usize, ) -> Result<Borrowed<'a, 'py, PyAny>, PyErr>
get_item, but returns a borrowed object, which is a slight performance optimization
by avoiding a reference count change.§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.§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 more§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.§fn contains<V>(&self, value: V) -> Result<bool, PyErr>where
V: IntoPyObject<'py>,
fn contains<V>(&self, value: V) -> Result<bool, PyErr>where
V: IntoPyObject<'py>,
value. Read more§fn iter(&self) -> BoundTupleIterator<'py> ⓘ
fn iter(&self) -> BoundTupleIterator<'py> ⓘ
§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.§impl<'py> PyTypeMethods<'py> for Bound<'py, PyType>
impl<'py> PyTypeMethods<'py> for Bound<'py, PyType>
§fn as_type_ptr(&self) -> *mut PyTypeObject
fn as_type_ptr(&self) -> *mut PyTypeObject
Retrieves the underlying FFI pointer associated with this Python object.
§fn module(&self) -> Result<Bound<'py, PyString>, PyErr>
fn module(&self) -> Result<Bound<'py, PyString>, PyErr>
Gets the name of the module defining the PyType.
§fn fully_qualified_name(&self) -> Result<Bound<'py, PyString>, PyErr>
fn fully_qualified_name(&self) -> Result<Bound<'py, PyString>, PyErr>
Gets the fully qualified name of the PyType.
§fn is_subclass(&self, other: &Bound<'_, PyAny>) -> Result<bool, PyErr>
fn is_subclass(&self, other: &Bound<'_, PyAny>) -> Result<bool, PyErr>
Checks whether self is a subclass of other.
Equivalent to the Python expression issubclass(self, other).
§fn is_subclass_of<T>(&self) -> Result<bool, PyErr>where
T: PyTypeInfo,
fn is_subclass_of<T>(&self) -> Result<bool, PyErr>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.
§impl<'py> PyTzInfoAccess<'py> for Bound<'py, PyDateTime>
impl<'py> PyTzInfoAccess<'py> for Bound<'py, PyDateTime>
§impl<'py> PyTzInfoAccess<'py> for Bound<'py, PyTime>
impl<'py> PyTzInfoAccess<'py> for Bound<'py, PyTime>
§impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakref>
impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakref>
§fn upgrade_as<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeCheck,
fn upgrade_as<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeCheck,
§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 more§fn upgrade_as_exact<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeInfo,
fn upgrade_as_exact<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeInfo,
§impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakrefProxy>
impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakrefProxy>
§fn upgrade_as<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeCheck,
fn upgrade_as<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeCheck,
§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 more§fn upgrade_as_exact<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeInfo,
fn upgrade_as_exact<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeInfo,
§impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakrefReference>
impl<'py> PyWeakrefMethods<'py> for Bound<'py, PyWeakrefReference>
§fn upgrade_as<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeCheck,
fn upgrade_as<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeCheck,
§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 more§fn upgrade_as_exact<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeInfo,
fn upgrade_as_exact<T>(&self) -> Result<Option<Bound<'py, T>>, PyErr>where
T: PyTypeInfo,
§impl<'py> TryFrom<&Bound<'py, PyAny>> for Bound<'py, PyByteArray>
impl<'py> TryFrom<&Bound<'py, PyAny>> for Bound<'py, PyByteArray>
§impl<'py> TryFrom<&Bound<'py, PyAny>> for Bound<'py, PyMemoryView>
impl<'py> TryFrom<&Bound<'py, PyAny>> for Bound<'py, PyMemoryView>
§impl TryFrom<Bound<'_, PyAny>> for SSLContext
impl TryFrom<Bound<'_, PyAny>> for SSLContext
§impl TryFrom<Bound<'_, PyString>> for PyBackedStr
impl TryFrom<Bound<'_, PyString>> for PyBackedStr
impl<'py> PyCallArgs<'py> for &Bound<'py, PyTuple>
impl<'py> PyCallArgs<'py> for Bound<'py, PyTuple>
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> UnsafeUnpin for Bound<'py, T>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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,
§impl<'py, T, I> IntoPyDict<'py> for Iwhere
T: PyDictItem<'py>,
I: IntoIterator<Item = T>,
impl<'py, T, I> IntoPyDict<'py> for Iwhere
T: PyDictItem<'py>,
I: IntoIterator<Item = T>,
§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.Source§impl<I> IteratorRandom for Iwhere
I: Iterator,
impl<I> IteratorRandom for Iwhere
I: Iterator,
Source§fn choose_stable<R>(self, rng: &mut R) -> Option<Self::Item>
fn choose_stable<R>(self, rng: &mut R) -> Option<Self::Item>
§impl<T> Itertools for T
impl<T> Itertools for T
§fn interleave<J>(
self,
other: J,
) -> Interleave<Self, <J as IntoIterator>::IntoIter>
fn interleave<J>( self, other: J, ) -> Interleave<Self, <J as IntoIterator>::IntoIter>
§fn interleave_shortest<J>(
self,
other: J,
) -> InterleaveShortest<Self, <J as IntoIterator>::IntoIter>
fn interleave_shortest<J>( self, other: J, ) -> InterleaveShortest<Self, <J as IntoIterator>::IntoIter>
§fn intersperse(
self,
element: Self::Item,
) -> IntersperseWith<Self, IntersperseElementSimple<Self::Item>>
fn intersperse( self, element: Self::Item, ) -> IntersperseWith<Self, IntersperseElementSimple<Self::Item>>
§fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F>
fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F>
§fn get<R>(self, index: R) -> <R as IteratorIndex<Self>>::Outputwhere
Self: Sized,
R: IteratorIndex<Self>,
fn get<R>(self, index: R) -> <R as IteratorIndex<Self>>::Outputwhere
Self: Sized,
R: IteratorIndex<Self>,
§fn zip_longest<J>(
self,
other: J,
) -> ZipLongest<Self, <J as IntoIterator>::IntoIter>where
J: IntoIterator,
Self: Sized,
fn zip_longest<J>(
self,
other: J,
) -> ZipLongest<Self, <J as IntoIterator>::IntoIter>where
J: IntoIterator,
Self: Sized,
§fn zip_eq<J>(self, other: J) -> ZipEq<Self, <J as IntoIterator>::IntoIter>where
J: IntoIterator,
Self: Sized,
fn zip_eq<J>(self, other: J) -> ZipEq<Self, <J as IntoIterator>::IntoIter>where
J: IntoIterator,
Self: Sized,
§fn batching<B, F>(self, f: F) -> Batching<Self, F>
fn batching<B, F>(self, f: F) -> Batching<Self, F>
§fn chunk_by<K, F>(self, key: F) -> ChunkBy<K, Self, F>
fn chunk_by<K, F>(self, key: F) -> ChunkBy<K, Self, F>
use_alloc only.§fn group_by<K, F>(self, key: F) -> ChunkBy<K, Self, F>
fn group_by<K, F>(self, key: F) -> ChunkBy<K, Self, F>
Use .chunk_by() instead
use_alloc only..chunk_by().§fn chunks(self, size: usize) -> IntoChunks<Self>where
Self: Sized,
fn chunks(self, size: usize) -> IntoChunks<Self>where
Self: Sized,
use_alloc only.§fn tuple_windows<T>(self) -> TupleWindows<Self, T>
fn tuple_windows<T>(self) -> TupleWindows<Self, T>
§fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T>
fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T>
§fn tuples<T>(self) -> Tuples<Self, T>
fn tuples<T>(self) -> Tuples<Self, T>
§fn tee(self) -> (Tee<Self>, Tee<Self>)
fn tee(self) -> (Tee<Self>, Tee<Self>)
use_alloc only.§fn map_ok<F, T, U, E>(self, f: F) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
fn map_ok<F, T, U, E>(self, f: F) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
Result::Ok value. Result::Err values are
unchanged. Read more§fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F>
fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F>
Result::Ok
value with the provided closure. Result::Err values are
unchanged. Read more§fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F>
fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F>
Result::Ok value with the provided closure. Result::Err
values are unchanged. Read more§fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E>
fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E>
Result::Ok value into
a series of Result::Ok values. Result::Err values are unchanged. Read more§fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
Result values instead. Read more§fn merge<J>(
self,
other: J,
) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeLte>
fn merge<J>( self, other: J, ) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeLte>
§fn merge_by<J, F>(
self,
other: J,
is_first: F,
) -> MergeBy<Self, <J as IntoIterator>::IntoIter, F>
fn merge_by<J, F>( self, other: J, is_first: F, ) -> MergeBy<Self, <J as IntoIterator>::IntoIter, F>
§fn merge_join_by<J, F, T>(
self,
other: J,
cmp_fn: F,
) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeFuncLR<F, <F as FuncLR<Self::Item, <<J as IntoIterator>::IntoIter as Iterator>::Item>>::T>>
fn merge_join_by<J, F, T>( self, other: J, cmp_fn: F, ) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeFuncLR<F, <F as FuncLR<Self::Item, <<J as IntoIterator>::IntoIter as Iterator>::Item>>::T>>
§fn kmerge(self) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, KMergeByLt>
fn kmerge(self) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, KMergeByLt>
use_alloc only.§fn kmerge_by<F>(
self,
first: F,
) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F>where
Self: Sized,
Self::Item: IntoIterator,
F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,
fn kmerge_by<F>(
self,
first: F,
) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F>where
Self: Sized,
Self::Item: IntoIterator,
F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,
use_alloc only.§fn cartesian_product<J>(
self,
other: J,
) -> Product<Self, <J as IntoIterator>::IntoIter>
fn cartesian_product<J>( self, other: J, ) -> Product<Self, <J as IntoIterator>::IntoIter>
self and J. Read more§fn multi_cartesian_product(
self,
) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter>where
Self: Sized,
Self::Item: IntoIterator,
<Self::Item as IntoIterator>::IntoIter: Clone,
<Self::Item as IntoIterator>::Item: Clone,
fn multi_cartesian_product(
self,
) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter>where
Self: Sized,
Self::Item: IntoIterator,
<Self::Item as IntoIterator>::IntoIter: Clone,
<Self::Item as IntoIterator>::Item: Clone,
use_alloc only.self. Read more§fn coalesce<F>(self, f: F) -> CoalesceBy<Self, F, NoCount>
fn coalesce<F>(self, f: F) -> CoalesceBy<Self, F, NoCount>
§fn dedup(self) -> CoalesceBy<Self, DedupPred2CoalescePred<DedupEq>, NoCount>
fn dedup(self) -> CoalesceBy<Self, DedupPred2CoalescePred<DedupEq>, NoCount>
§fn dedup_by<Cmp>(
self,
cmp: Cmp,
) -> CoalesceBy<Self, DedupPred2CoalescePred<Cmp>, NoCount>
fn dedup_by<Cmp>( self, cmp: Cmp, ) -> CoalesceBy<Self, DedupPred2CoalescePred<Cmp>, NoCount>
§fn dedup_with_count(
self,
) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<DedupEq>, WithCount>where
Self: Sized,
fn dedup_with_count(
self,
) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<DedupEq>, WithCount>where
Self: Sized,
§fn dedup_by_with_count<Cmp>(
self,
cmp: Cmp,
) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<Cmp>, WithCount>
fn dedup_by_with_count<Cmp>( self, cmp: Cmp, ) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<Cmp>, WithCount>
§fn duplicates(self) -> DuplicatesBy<Self, Self::Item, ById>
fn duplicates(self) -> DuplicatesBy<Self, Self::Item, ById>
use_std only.§fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, ByFn<F>>
fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, ByFn<F>>
use_std only.§fn unique(self) -> Unique<Self>
fn unique(self) -> Unique<Self>
use_std only.§fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F>
fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F>
use_std only.§fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F>
fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F>
accept returns true. Read more§fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F>
fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F>
Clone-able iterator
to only pick off elements while the predicate accept returns true. Read more§fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F>
fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F>
true, including the element for which the predicate
first returned false. Read more§fn while_some<A>(self) -> WhileSome<Self>
fn while_some<A>(self) -> WhileSome<Self>
Option<A> iterator elements
and produces A. Stops on the first None encountered. Read more§fn tuple_combinations<T>(self) -> TupleCombinations<Self, T>
fn tuple_combinations<T>(self) -> TupleCombinations<Self, T>
§fn combinations(self, k: usize) -> Combinations<Self>
fn combinations(self, k: usize) -> Combinations<Self>
use_alloc only.k-length combinations of
the elements from an iterator. Read more§fn combinations_with_replacement(
self,
k: usize,
) -> CombinationsWithReplacement<Self>
fn combinations_with_replacement( self, k: usize, ) -> CombinationsWithReplacement<Self>
use_alloc only.k-length combinations of
the elements from an iterator, with replacement. Read more§fn permutations(self, k: usize) -> Permutations<Self>
fn permutations(self, k: usize) -> Permutations<Self>
use_alloc only.§fn powerset(self) -> Powerset<Self>
fn powerset(self) -> Powerset<Self>
use_alloc only.§fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F>
fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F>
min by filling missing elements using a closure f. Read more§fn with_position(self) -> WithPosition<Self>where
Self: Sized,
fn with_position(self) -> WithPosition<Self>where
Self: Sized,
Position to
ease special-case handling of the first or last elements. Read more§fn positions<P>(self, predicate: P) -> Positions<Self, P>
fn positions<P>(self, predicate: P) -> Positions<Self, P>
§fn update<F>(self, updater: F) -> Update<Self, F>
fn update<F>(self, updater: F) -> Update<Self, F>
§fn next_tuple<T>(&mut self) -> Option<T>
fn next_tuple<T>(&mut self) -> Option<T>
§fn collect_tuple<T>(self) -> Option<T>
fn collect_tuple<T>(self) -> Option<T>
§fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
§fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
§fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
§fn contains<Q>(&mut self, query: &Q) -> bool
fn contains<Q>(&mut self, query: &Q) -> bool
true if the given item is present in this iterator. Read more§fn all_equal_value(
&mut self,
) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
fn all_equal_value( &mut self, ) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
§fn all_unique(&mut self) -> bool
fn all_unique(&mut self) -> bool
use_std only.§fn dropping(self, n: usize) -> Selfwhere
Self: Sized,
fn dropping(self, n: usize) -> Selfwhere
Self: Sized,
n elements from the iterator eagerly,
and return the same iterator again. Read more§fn dropping_back(self, n: usize) -> Selfwhere
Self: Sized + DoubleEndedIterator,
fn dropping_back(self, n: usize) -> Selfwhere
Self: Sized + DoubleEndedIterator,
n elements from the iterator eagerly,
and return the same iterator again. Read more§fn collect_vec(self) -> Vec<Self::Item>where
Self: Sized,
fn collect_vec(self) -> Vec<Self::Item>where
Self: Sized,
use_alloc only..collect_vec() is simply a type specialization of Iterator::collect,
for convenience.§fn try_collect<T, U, E>(self) -> Result<U, E>
fn try_collect<T, U, E>(self) -> Result<U, E>
§fn set_from<'a, A, J>(&mut self, from: J) -> usize
fn set_from<'a, A, J>(&mut self, from: J) -> usize
self from the from iterator,
stopping at the shortest of the two iterators. Read more§fn format(self, sep: &str) -> Format<'_, Self>where
Self: Sized,
fn format(self, sep: &str) -> Format<'_, Self>where
Self: Sized,
sep. Read more§fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
sep. Read more§fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
Result values from an iterator. Read more§fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
Option values from an iterator. Read more§fn fold1<F>(self, f: F) -> Option<Self::Item>
fn fold1<F>(self, f: F) -> Option<Self::Item>
Use Iterator::reduce instead
§fn tree_reduce<F>(self, f: F) -> Option<Self::Item>
fn tree_reduce<F>(self, f: F) -> Option<Self::Item>
§fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
Use .tree_reduce() instead
.tree_reduce().§fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
§fn product1<P>(self) -> Option<P>
fn product1<P>(self) -> Option<P>
§fn sorted_unstable(self) -> IntoIter<Self::Item> ⓘ
fn sorted_unstable(self) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item> ⓘ
fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn sorted(self) -> IntoIter<Self::Item> ⓘ
fn sorted(self) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item> ⓘ
fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn k_smallest(self, k: usize) -> IntoIter<Self::Item> ⓘ
fn k_smallest(self, k: usize) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn k_smallest_by<F>(self, k: usize, cmp: F) -> IntoIter<Self::Item> ⓘ
fn k_smallest_by<F>(self, k: usize, cmp: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn k_smallest_by_key<F, K>(self, k: usize, key: F) -> IntoIter<Self::Item> ⓘ
fn k_smallest_by_key<F, K>(self, k: usize, key: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn k_largest(self, k: usize) -> IntoIter<Self::Item> ⓘ
fn k_largest(self, k: usize) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn k_largest_by<F>(self, k: usize, cmp: F) -> IntoIter<Self::Item> ⓘ
fn k_largest_by<F>(self, k: usize, cmp: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn k_largest_by_key<F, K>(self, k: usize, key: F) -> IntoIter<Self::Item> ⓘ
fn k_largest_by_key<F, K>(self, k: usize, key: F) -> IntoIter<Self::Item> ⓘ
use_alloc only.§fn tail(self, n: usize) -> IntoIter<Self::Item> ⓘwhere
Self: Sized,
fn tail(self, n: usize) -> IntoIter<Self::Item> ⓘwhere
Self: Sized,
use_alloc only.n elements. Read more§fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
Iterator::partition, each partition may
have a distinct type. Read more§fn partition_result<A, B, T, E>(self) -> (A, B)
fn partition_result<A, B, T, E>(self) -> (A, B)
Results into one list of all the Ok elements
and another list of all the Err elements. Read more§fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
use_std only.HashMap of keys mapped to Vecs of values. Keys and values
are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more§fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
use_std only.Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified
in the closure. Read more§fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
use_std only.GroupingMap to be used later with one of the efficient
group-and-fold operations it allows to perform. Read more§fn into_grouping_map_by<K, V, F>(
self,
key_mapper: F,
) -> GroupingMap<MapSpecialCase<Self, GroupingMapFn<F>>>
fn into_grouping_map_by<K, V, F>( self, key_mapper: F, ) -> GroupingMap<MapSpecialCase<Self, GroupingMapFn<F>>>
use_std only.GroupingMap to be used later with one of the efficient
group-and-fold operations it allows to perform. Read more§fn min_set(self) -> Vec<Self::Item>
fn min_set(self) -> Vec<Self::Item>
use_alloc only.§fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
use_alloc only.§fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
use_alloc only.§fn max_set(self) -> Vec<Self::Item>
fn max_set(self) -> Vec<Self::Item>
use_alloc only.§fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
use_alloc only.§fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
use_alloc only.§fn minmax(self) -> MinMaxResult<Self::Item>
fn minmax(self) -> MinMaxResult<Self::Item>
§fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
§fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
§fn position_max(self) -> Option<usize>
fn position_max(self) -> Option<usize>
§fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
§fn position_max_by<F>(self, compare: F) -> Option<usize>
fn position_max_by<F>(self, compare: F) -> Option<usize>
§fn position_min(self) -> Option<usize>
fn position_min(self) -> Option<usize>
§fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
§fn position_min_by<F>(self, compare: F) -> Option<usize>
fn position_min_by<F>(self, compare: F) -> Option<usize>
§fn position_minmax(self) -> MinMaxResult<usize>
fn position_minmax(self) -> MinMaxResult<usize>
§fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
§fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
§fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>where
Self: Sized,
fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>where
Self: Sized,
§fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>where
Self: Sized,
fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>where
Self: Sized,
Ok(None) will be returned. If the iterator yields
exactly one element, that element will be returned, otherwise an error will be returned
containing an iterator that has the same output as the input iterator. Read more§fn multipeek(self) -> MultiPeek<Self>where
Self: Sized,
fn multipeek(self) -> MultiPeek<Self>where
Self: Sized,
use_alloc only..next()
values without advancing the base iterator. Read more§fn counts(self) -> HashMap<Self::Item, usize>
fn counts(self) -> HashMap<Self::Item, usize>
use_std only.HashMap which
contains each item that appears in the iterator and the number
of times it appears. Read more§fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
use_std only.HashMap which
contains each item that appears in the iterator and the number
of times it appears,
determining identity using a keying function. Read more