Struct pyo3::PyList [−][src]
pub struct PyList(_);
Represents a Python list
.
Methods
impl PyList
[src]
impl PyList
pub fn new<'p, T: ToPyObject>(py: Python<'p>, elements: &[T]) -> &'p PyList
[src]
pub fn new<'p, T: ToPyObject>(py: Python<'p>, elements: &[T]) -> &'p PyList
Construct a new list with the given elements.
pub fn empty(py: Python) -> &PyList
[src]
pub fn empty(py: Python) -> &PyList
Construct a new empty list.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Gets the length of the list.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Check if list is empty.
pub fn get_item(&self, index: isize) -> &PyObjectRef
[src]
pub fn get_item(&self, index: isize) -> &PyObjectRef
Gets the item at the specified index.
Panics if the index is out of range.
pub fn get_parked_item(&self, index: isize) -> PyObject
[src]
pub fn get_parked_item(&self, index: isize) -> PyObject
Gets the item at the specified index.
Panics if the index is out of range.
pub fn set_item<I>(&self, index: isize, item: I) -> PyResult<()> where
I: ToPyObject,
[src]
pub fn set_item<I>(&self, index: isize, item: I) -> PyResult<()> where
I: ToPyObject,
Sets the item at the specified index.
Panics if the index is out of range.
pub fn append<I>(&self, item: I) -> PyResult<()> where
I: ToBorrowedObject,
[src]
pub fn append<I>(&self, item: I) -> PyResult<()> where
I: ToBorrowedObject,
Appends an item at the list.
pub fn insert<I>(&self, index: isize, item: I) -> PyResult<()> where
I: ToBorrowedObject,
[src]
pub fn insert<I>(&self, index: isize, item: I) -> PyResult<()> where
I: ToBorrowedObject,
Inserts an item at the specified index.
Panics if the index is out of range.
pub fn iter(&self) -> PyListIterator
[src]
pub fn iter(&self) -> PyListIterator
Returns an iterator over the tuple items.
Trait Implementations
impl<'a> From<&'a PyList> for &'a PyObjectRef
[src]
impl<'a> From<&'a PyList> for &'a PyObjectRef
impl AsRef<PyObjectRef> for PyList
[src]
impl AsRef<PyObjectRef> for PyList
fn as_ref(&self) -> &PyObjectRef
[src]
fn as_ref(&self) -> &PyObjectRef
Performs the conversion.
impl PyObjectWithToken for PyList
[src]
impl PyObjectWithToken for PyList
impl ToPyPointer for PyList
[src]
impl ToPyPointer for PyList
impl PartialEq for PyList
[src]
impl PartialEq for PyList
fn eq(&self, o: &PyList) -> bool
[src]
fn eq(&self, o: &PyList) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PyTypeInfo for PyList
[src]
impl PyTypeInfo for PyList
type Type = ()
Type of objects to store in PyObject struct
type BaseType = PyObjectRef
Base class
const NAME: &'static str
NAME: &'static str = "PyList"
Class name
const SIZE: usize
SIZE: usize = ::std::mem::size_of::<::ffi::PyObject>()
Size of the rust PyObject structure (PyObject + rust structure)
const OFFSET: isize
OFFSET: isize = 0
Type
instance offset inside PyObject structure
unsafe fn type_object() -> &'static mut PyTypeObject
[src]
unsafe fn type_object() -> &'static mut PyTypeObject
PyTypeObject instance for this type
fn is_instance(ptr: *mut PyObject) -> bool
[src]
fn is_instance(ptr: *mut PyObject) -> bool
Check if *mut ffi::PyObject
is instance of this type
const DESCRIPTION: &'static str
DESCRIPTION: &'static str = "\u{0}"
Class doc string
const FLAGS: usize
FLAGS: usize = 0
Type flags (ie PY_TYPE_FLAG_GC, PY_TYPE_FLAG_WEAKREF)
fn is_exact_instance(ptr: *mut PyObject) -> bool
[src]
fn is_exact_instance(ptr: *mut PyObject) -> bool
Check if *mut ffi::PyObject
is exact instance of this type
impl PyTypeObject for PyList
[src]
impl PyTypeObject for PyList
fn init_type()
[src]
fn init_type()
Initialize type object
fn type_object() -> Py<PyType>
[src]
fn type_object() -> Py<PyType>
Retrieves the type object for this Python object type.
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo,
[src]
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo,
Create PyRawObject which can be initialized with rust value
impl ToPyObject for PyList
[src]
impl ToPyObject for PyList
impl ToBorrowedObject for PyList
[src]
impl ToBorrowedObject for PyList
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R,
[src]
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R,
Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more
impl Debug for PyList
[src]
impl Debug for PyList
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Display for PyList
[src]
impl Display for PyList
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'a> FromPyObject<'a> for &'a PyList
[src]
impl<'a> FromPyObject<'a> for &'a PyList
fn extract(ob: &'a PyObjectRef) -> PyResult<Self>
[src]
fn extract(ob: &'a PyObjectRef) -> PyResult<Self>
Extracts Self
from the source PyObject
.
impl<'a> IntoIterator for &'a PyList
[src]
impl<'a> IntoIterator for &'a PyList