[−][src]Struct cpython::PyList
Represents a Python list.
Methods
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]
fn as_object(&self) -> &PyObject[src]
fn into_object(self) -> PyObject[src]
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.
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]
fn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PyList, PythonObjectDowncastError<'p>>[src]
py: Python<'p>,
obj: PyObject
) -> Result<PyList, PythonObjectDowncastError<'p>>
fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyList, PythonObjectDowncastError<'p>>[src]
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyList, PythonObjectDowncastError<'p>>
impl PythonObjectWithTypeObject for PyList[src]
fn type_object(py: Python) -> PyType[src]
impl ToPyObject for PyList[src]
Identity conversion: allows using existing PyObject instances where
T: ToPyObject is expected.
type ObjectType = PyList
fn to_py_object(&self, py: Python) -> PyList[src]
fn into_py_object(self, _py: Python) -> PyList[src]
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R, [src]
F: FnOnce(*mut PyObject) -> R,
Auto Trait Implementations
impl RefUnwindSafe for PyList
impl Send for PyList
impl Sync for PyList
impl Unpin for PyList
impl UnwindSafe for PyList
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,