Struct pyo3::prelude::PyTuple [−][src]
pub struct PyTuple(_);
Represents a Python tuple
object.
Methods
impl PyTuple
[src]
impl PyTuple
pub fn new<T: ToPyObject>(py: Python, elements: &[T]) -> Py<PyTuple>
[src]
pub fn new<T: ToPyObject>(py: Python, elements: &[T]) -> Py<PyTuple>
Construct a new tuple with the given elements.
pub fn empty(_py: Python) -> Py<PyTuple>
[src]
pub fn empty(_py: Python) -> Py<PyTuple>
Retrieves the empty tuple.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Gets the length of the tuple.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Check if tuple is empty.
pub fn slice(&self, low: isize, high: isize) -> Py<PyTuple>
[src]
pub fn slice(&self, low: isize, high: isize) -> Py<PyTuple>
Take a slice of the tuple pointed to by p from low to high and return it as a new tuple.
pub fn split_from(&self, low: isize) -> Py<PyTuple>
[src]
pub fn split_from(&self, low: isize) -> Py<PyTuple>
Take a slice of the tuple pointed to by p from low and return it as a new tuple.
pub fn get_item(&self, index: usize) -> &PyObjectRef
[src]
pub fn get_item(&self, index: usize) -> &PyObjectRef
Gets the item at the specified index.
Panics if the index is out of range.
pub fn as_slice(&self) -> &[PyObject]
[src]
pub fn as_slice(&self) -> &[PyObject]
pub fn iter(&self) -> PyTupleIterator
[src]
pub fn iter(&self) -> PyTupleIterator
Returns an iterator over the tuple items.
Trait Implementations
impl<'a> From<&'a PyTuple> for &'a PyObjectRef
[src]
impl<'a> From<&'a PyTuple> for &'a PyObjectRef
impl AsRef<PyObjectRef> for PyTuple
[src]
impl AsRef<PyObjectRef> for PyTuple
fn as_ref(&self) -> &PyObjectRef
[src]
fn as_ref(&self) -> &PyObjectRef
Performs the conversion.
impl PyObjectWithToken for PyTuple
[src]
impl PyObjectWithToken for PyTuple
impl ToPyPointer for PyTuple
[src]
impl ToPyPointer for PyTuple
impl PartialEq for PyTuple
[src]
impl PartialEq for PyTuple
fn eq(&self, o: &PyTuple) -> bool
[src]
fn eq(&self, o: &PyTuple) -> 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 PyTuple
[src]
impl PyTypeInfo for PyTuple
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]
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 PyTuple
[src]
impl PyTypeObject for PyTuple
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 PyTuple
[src]
impl ToPyObject for PyTuple
impl ToBorrowedObject for PyTuple
[src]
impl ToBorrowedObject for PyTuple
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 PyTuple
[src]
impl Debug for PyTuple
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 PyTuple
[src]
impl Display for PyTuple
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 PyTuple
[src]
impl<'a> FromPyObject<'a> for &'a PyTuple
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 PyTuple
[src]
impl<'a> IntoIterator for &'a PyTuple
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]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a> IntoPyTuple for &'a PyTuple
[src]
impl<'a> IntoPyTuple for &'a PyTuple
fn into_tuple(self, _py: Python) -> Py<PyTuple>
[src]
fn into_tuple(self, _py: Python) -> Py<PyTuple>
Converts self into a PyTuple object.