Struct pyo3::PyTuple
[−]
[src]
pub struct PyTuple(_);
Represents a Python tuple object.
Methods
impl PyTuple[src]
fn new<T: ToPyObject>(py: Python, elements: &[T]) -> Py<PyTuple>[src]
Construct a new tuple with the given elements.
fn empty(_py: Python) -> Py<PyTuple>[src]
Retrieves the empty tuple.
fn len(&self) -> usize[src]
Gets the length of the tuple.
fn slice(&self, low: isize, high: isize) -> Py<PyTuple>[src]
Take a slice of the tuple pointed to by p from low to high and return it as a new tuple.
fn split_from(&self, low: isize) -> Py<PyTuple>[src]
Take a slice of the tuple pointed to by p from low and return it as a new tuple.
fn get_item(&self, index: usize) -> &PyObjectRef[src]
Gets the item at the specified index.
Panics if the index is out of range.
fn as_slice(&self) -> &[PyObject][src]
fn iter(&self) -> PyTupleIterator[src]
Returns an iterator over the tuple items.
Trait Implementations
impl AsRef<PyObjectRef> for PyTuple[src]
fn as_ref(&self) -> &PyObjectRef[src]
Performs the conversion.
impl PyObjectWithToken for PyTuple[src]
impl ToPyPointer for PyTuple[src]
impl PartialEq for PyTuple[src]
fn eq(&self, o: &PyTuple) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl PyTypeInfo for PyTuple[src]
type Type = ()
Type of objects to store in PyObject struct
type BaseType = PyObjectRef
Base class
const NAME: &'static str
NAME: &'static str = "PyTuple"
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]
PyTypeObject instance for this type
fn is_instance(ptr: *mut PyObject) -> bool[src]
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]
Check if *mut ffi::PyObject is exact instance of this type
impl PyTypeObject for PyTuple[src]
fn init_type()[src]
Initialize type object
fn type_object() -> Py<PyType>[src]
Retrieves the type object for this Python object type.
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo, [src]
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo,
Create PyRawObject which can be initialized with rust value
impl ToPyObject for PyTuple[src]
impl ToBorrowedObject for PyTuple[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,
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 PyTuple[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
Formats the value using the given formatter.
impl Display for PyTuple[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
Formats the value using the given formatter. Read more
impl<'a> FromPyObject<'a> for &'a PyTuple[src]
fn extract(ob: &'a PyObjectRef) -> PyResult<Self>[src]
Extracts Self from the source PyObject.
impl<'a> IntoIterator for &'a PyTuple[src]
type Item = &'a PyObjectRef
The type of the elements being iterated over.
type IntoIter = PyTupleIterator<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter[src]
Creates an iterator from a value. Read more
impl<'a> IntoPyTuple for &'a PyTuple[src]
fn into_tuple(self, _py: Python) -> Py<PyTuple>[src]
Converts self into a PyTuple object.