[−][src]Struct cpython::PyTuple
Represents a Python tuple object.
Implementations
impl PyTuple
[src]
pub fn new(py: Python<'_>, elements: &[PyObject]) -> PyTuple
[src]
Construct a new tuple with the given elements.
pub fn empty(py: Python<'_>) -> PyTuple
[src]
Retrieves the empty tuple.
pub fn len(&self, _py: Python<'_>) -> usize
[src]
Gets the length of the tuple.
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 as_slice<'a>(&'a self, py: Python<'_>) -> &'a [PyObject]
[src]
pub fn iter(&self, py: Python<'_>) -> Iter<'_, PyObject>
[src]
Trait Implementations
impl<'s> FromPyObject<'s> for PyTuple
[src]
impl<'s> FromPyObject<'s> for &'s PyTuple
[src]
impl PythonObject for PyTuple
[src]
pub fn as_object(&self) -> &PyObject
[src]
pub fn into_object(self) -> PyObject
[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 PyTuple
[src]
pub fn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PyTuple, PythonObjectDowncastError<'p>>
[src]
py: Python<'p>,
obj: PyObject
) -> Result<PyTuple, PythonObjectDowncastError<'p>>
pub fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyTuple, PythonObjectDowncastError<'p>>
[src]
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PyTuple, PythonObjectDowncastError<'p>>
impl PythonObjectWithTypeObject for PyTuple
[src]
pub fn type_object(py: Python<'_>) -> PyType
[src]
impl ToPyObject for PyTuple
[src]
Identity conversion: allows using existing PyObject
instances where
T: ToPyObject
is expected.
type ObjectType = PyTuple
pub fn to_py_object(&self, py: Python<'_>) -> PyTuple
[src]
pub fn into_py_object(self, _py: Python<'_>) -> PyTuple
[src]
pub 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 PyTuple
[src]
impl Send for PyTuple
[src]
impl Sync for PyTuple
[src]
impl Unpin for PyTuple
[src]
impl UnwindSafe for PyTuple
[src]
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,
pub 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.
pub 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>,