Struct cpython::PyIterator[][src]

pub struct PyIterator<'p> { /* fields omitted */ }

A python iterator object.

Unlike other python objects, this class includes a Python<'p> token so that PyIterator can implement the rust Iterator trait.

Implementations

impl<'p> PyIterator<'p>[src]

pub fn from_object(
    py: Python<'p>,
    obj: PyObject
) -> Result<PyIterator<'p>, PythonObjectDowncastError<'p>>
[src]

Constructs a PyIterator from a Python iterator object.

pub fn as_object(&self) -> &PyObject[src]

Gets the Python iterator object.

pub fn into_object(self) -> PyObject[src]

Gets the Python iterator object.

Trait Implementations

impl<'p> Iterator for PyIterator<'p>[src]

type Item = PyResult<PyObject>

The type of the elements being iterated over.

fn next(&mut self) -> Option<PyResult<PyObject>>[src]

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.

Auto Trait Implementations

impl<'p> !RefUnwindSafe for PyIterator<'p>[src]

impl<'p> !Send for PyIterator<'p>[src]

impl<'p> !Sync for PyIterator<'p>[src]

impl<'p> Unpin for PyIterator<'p>[src]

impl<'p> !UnwindSafe for PyIterator<'p>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.