pub struct PyList { /* private fields */ }
Expand description
An analog of a Python list which contains an undefined number of elements of a single kind, of any supported type.
Read the module docs for more information.
Implementations§
Source§impl PyList
impl PyList
Sourcepub fn new() -> PyList
pub fn new() -> PyList
Constructs a new, empty PyList<T>
.
The vector will not allocate until elements are pushed onto it.
Sourcepub fn remove<T>(&mut self, index: usize) -> T
pub fn remove<T>(&mut self, index: usize) -> T
Removes and returns the element at position index
within the vector,
shifting all elements after it to the left.
Sourcepub fn pop<T>(&mut self) -> Option<T>
pub fn pop<T>(&mut self) -> Option<T>
Removes the last element from a vector and returns it, or None
if it is empty.
pub fn is_empty(&self) -> bool
Sourcepub fn push<T>(&mut self, a: T)
pub fn push<T>(&mut self, a: T)
Appends an element to the back of a collection.
##Panics
Panics if the number of elements in the vector overflows a usize.
Trait Implementations§
Source§impl<T> FromIterator<T> for PyList
impl<T> FromIterator<T> for PyList
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
impl StructuralPartialEq for PyList
Auto Trait Implementations§
impl Freeze for PyList
impl RefUnwindSafe for PyList
impl !Send for PyList
impl !Sync for PyList
impl Unpin for PyList
impl UnwindSafe for PyList
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
Mutably borrows from an owned value. Read more