[][src]Struct cpython::PyList

pub struct PyList(_);

Represents a Python list.

Implementations

impl PyList[src]

pub fn new(py: Python<'_>, elements: &[PyObject]) -> PyList[src]

Construct a new list with the given elements.

pub fn len(&self, _py: Python<'_>) -> usize[src]

Gets the length of the list.

pub fn get_item(&self, py: Python<'_>, index: usize) -> PyObject[src]

Gets the item at the specified index.

Panics if the index is out of range.

pub fn set_item(&self, _py: Python<'_>, index: usize, item: PyObject)[src]

Sets the item at the specified index.

Panics if the index is out of range.

pub fn insert(&self, _py: Python<'_>, index: usize, item: PyObject)[src]

Inserts an item at the specified index.

Panics if the index is out of range.

pub fn append(&self, _py: Python<'_>, item: PyObject)[src]

Appends an item to the end of the list

pub fn iter<'a, 'p>(&'a self, py: Python<'p>) -> PyListIterator<'a, 'p>[src]

Trait Implementations

impl<'s> FromPyObject<'s> for PyList[src]

impl<'s> FromPyObject<'s> for &'s PyList[src]

impl PythonObject for PyList[src]

pub unsafe fn unchecked_downcast_from(obj: PyObject) -> Self[src]

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

pub unsafe fn unchecked_downcast_borrow_from<'a>(obj: &'a PyObject) -> &'a Self[src]

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

impl PythonObjectWithCheckedDowncast for PyList[src]

impl PythonObjectWithTypeObject for PyList[src]

impl ToPyObject for PyList[src]

Identity conversion: allows using existing PyObject instances where T: ToPyObject is expected.

type ObjectType = PyList

Auto Trait Implementations

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<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.