Struct cpython::PyTuple [−][src]
pub struct PyTuple(_);
Represents a Python tuple object.
Methods
impl PyTuple[src]
impl PyTuplepub fn new(py: Python, elements: &[PyObject]) -> PyTuple[src]
pub fn new(py: Python, elements: &[PyObject]) -> PyTupleConstruct a new tuple with the given elements.
pub fn empty(py: Python) -> PyTuple[src]
pub fn empty(py: Python) -> PyTupleRetrieves the empty tuple.
pub fn len(&self, _py: Python) -> usize[src]
pub fn len(&self, _py: Python) -> usizeGets the length of the tuple.
pub fn get_item(&self, py: Python, index: usize) -> PyObject[src]
pub fn get_item(&self, py: Python, index: usize) -> PyObjectGets the item at the specified index.
Panics if the index is out of range.
pub fn as_slice<'a>(&'a self, py: Python) -> &'a [PyObject][src]
pub fn as_slice<'a>(&'a self, py: Python) -> &'a [PyObject]ⓘImportant traits for Iter<'a, T>pub fn iter(&self, py: Python) -> Iter<PyObject>[src]
pub fn iter(&self, py: Python) -> Iter<PyObject>Trait Implementations
impl ToPyObject for PyTuple[src]
impl ToPyObject for PyTupleIdentity conversion: allows using existing PyObject instances where
T: ToPyObject is expected.
type ObjectType = PyTuple
fn to_py_object(&self, py: Python) -> PyTuple[src]
fn to_py_object(&self, py: Python) -> PyTupleConverts self into a Python object.
fn into_py_object(self, _py: Python) -> PyTuple[src]
fn into_py_object(self, _py: Python) -> PyTupleConverts self into a Python object. Read more
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<'source> FromPyObject<'source> for PyTuple[src]
impl<'source> FromPyObject<'source> for PyTuplefn extract(py: Python, obj: &'source PyObject) -> PyResult<PyTuple>[src]
fn extract(py: Python, obj: &'source PyObject) -> PyResult<PyTuple>Extracts Self from the source PyObject.
impl<'source> FromPyObject<'source> for &'source PyTuple[src]
impl<'source> FromPyObject<'source> for &'source PyTuplefn extract(py: Python, obj: &'source PyObject) -> PyResult<&'source PyTuple>[src]
fn extract(py: Python, obj: &'source PyObject) -> PyResult<&'source PyTuple>Extracts Self from the source PyObject.
impl PythonObject for PyTuple[src]
impl PythonObject for PyTuplefn as_object(&self) -> &PyObject[src]
fn as_object(&self) -> &PyObjectCasts the Python object to PyObject.
fn into_object(self) -> PyObject[src]
fn into_object(self) -> PyObjectCasts the Python object to PyObject.
unsafe fn unchecked_downcast_from(obj: PyObject) -> Self[src]
unsafe fn unchecked_downcast_from(obj: PyObject) -> SelfUnchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.
ⓘImportant traits for &'a mut Runsafe fn unchecked_downcast_borrow_from<'a>(obj: &'a PyObject) -> &'a Self[src]
unsafe fn unchecked_downcast_borrow_from<'a>(obj: &'a PyObject) -> &'a SelfUnchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.
impl PythonObjectWithCheckedDowncast for PyTuple[src]
impl PythonObjectWithCheckedDowncast for PyTuplefn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PyTuple, PythonObjectDowncastError<'p>>[src]
fn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PyTuple, PythonObjectDowncastError<'p>>Cast from PyObject to a concrete Python object type.
fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyTuple, PythonObjectDowncastError<'p>>[src]
fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyTuple, PythonObjectDowncastError<'p>>Cast from PyObject to a concrete Python object type.
impl PythonObjectWithTypeObject for PyTuple[src]
impl PythonObjectWithTypeObject for PyTuplefn type_object(py: Python) -> PyType[src]
fn type_object(py: Python) -> PyTypeRetrieves the type object for this Python object type.