[−][src]Struct pyo3::types::PySequence
Represents a reference to a Python object supporting the sequence protocol.
Implementations
impl PySequence[src]
pub fn len(&self) -> PyResult<isize>[src]
Returns the number of objects in sequence.
This is equivalent to the Python expression len(self).
pub fn is_empty(&self) -> PyResult<bool>[src]
pub fn concat(&self, other: &PySequence) -> PyResult<&PySequence>[src]
Returns the concatenation of self and other.
This is equivalent to the Python expression self + other.
pub fn repeat(&self, count: isize) -> PyResult<&PySequence>[src]
Returns the result of repeating a sequence object count times.
This is equivalent to the Python expression self * count.
NB: Python accepts negative counts; it returns an empty Sequence.
pub fn in_place_concat(&self, other: &PySequence) -> PyResult<()>[src]
Concatenates self and other in place.
This is equivalent to the Python statement self += other.
pub fn in_place_repeat(&self, count: isize) -> PyResult<()>[src]
Repeats the sequence object count times and updates self.
This is equivalent to the Python statement self *= count.
NB: Python accepts negative counts; it empties the Sequence.
pub fn get_item(&self, index: isize) -> PyResult<&PyAny>[src]
Returns the indexth element of the Sequence.
This is equivalent to the Python expression self[index].
pub fn get_slice(&self, begin: isize, end: isize) -> PyResult<&PyAny>[src]
Returns the slice of sequence object between begin and end.
This is equivalent to the Python expression self[begin:end].
pub fn set_item<I>(&self, i: isize, item: I) -> PyResult<()> where
I: ToBorrowedObject, [src]
I: ToBorrowedObject,
Assigns object item to the ith element of self.
This is equivalent to the Python statement self[i] = v.
pub fn del_item(&self, i: isize) -> PyResult<()>[src]
Deletes the ith element of self.
This is equivalent to the Python statement del self[i].
pub fn set_slice(&self, i1: isize, i2: isize, v: &PyAny) -> PyResult<()>[src]
Assigns the sequence v to the slice of self from i1 to i2.
This is equivalent to the Python statement self[i1:i2] = v.
pub fn del_slice(&self, i1: isize, i2: isize) -> PyResult<()>[src]
Deletes the slice from i1 to i2 from self.
This is equivalent to the Python statement del self[i1:i2].
pub fn count<V>(&self, value: V) -> PyResult<usize> where
V: ToBorrowedObject, [src]
V: ToBorrowedObject,
Returns the number of occurrences of value in self, that is, return the
number of keys for which self[key] == value.
pub fn contains<V>(&self, value: V) -> PyResult<bool> where
V: ToBorrowedObject, [src]
V: ToBorrowedObject,
Determines if self contains value.
This is equivalent to the Python expression value in self.
pub fn index<V>(&self, value: V) -> PyResult<usize> where
V: ToBorrowedObject, [src]
V: ToBorrowedObject,
Returns the first index i for which self[i] == value.
This is equivalent to the Python expression self.index(value).
pub fn list(&self) -> PyResult<&PyList>[src]
Returns a fresh list based on the Sequence.
pub fn tuple(&self) -> PyResult<&PyTuple>[src]
Returns a fresh tuple based on the Sequence.
Trait Implementations
impl AsPyPointer for PySequence[src]
impl AsRef<PyAny> for PySequence[src]
impl<'py> FromPyObject<'py> for &'py PySequence[src]
impl PartialEq<PySequence> for PySequence[src]
impl PyNativeType for PySequence[src]
impl<'v> PyTryFrom<'v> for PySequence[src]
fn try_from<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v PySequence, PyDowncastError>[src]
value: V
) -> Result<&'v PySequence, PyDowncastError>
fn try_from_exact<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v PySequence, PyDowncastError>[src]
value: V
) -> Result<&'v PySequence, PyDowncastError>
unsafe fn try_from_unchecked<V: Into<&'v PyAny>>(value: V) -> &'v PySequence[src]
Auto Trait Implementations
impl !RefUnwindSafe for PySequence
impl !Send for PySequence
impl !Sync for PySequence
impl Unpin for PySequence
impl UnwindSafe for PySequence
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,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> FromPy<T> for T[src]
impl<'p, T> FromPyPointer<'p> for T where
T: 'p + PyNativeType, [src]
T: 'p + PyNativeType,
unsafe fn from_owned_ptr_or_opt(Python<'p>, *mut PyObject) -> Option<&'p T>[src]
unsafe fn from_borrowed_ptr_or_opt(Python<'p>, *mut PyObject) -> Option<&'p T>[src]
unsafe fn from_owned_ptr_or_panic(
py: Python<'p>,
ptr: *mut PyObject
) -> &'p Self[src]
py: Python<'p>,
ptr: *mut PyObject
) -> &'p Self
unsafe fn from_owned_ptr(py: Python<'p>, ptr: *mut PyObject) -> &'p Self[src]
unsafe fn from_owned_ptr_or_err(
py: Python<'p>,
ptr: *mut PyObject
) -> PyResult<&'p Self>[src]
py: Python<'p>,
ptr: *mut PyObject
) -> PyResult<&'p Self>
unsafe fn from_borrowed_ptr_or_panic(
py: Python<'p>,
ptr: *mut PyObject
) -> &'p Self[src]
py: Python<'p>,
ptr: *mut PyObject
) -> &'p Self
unsafe fn from_borrowed_ptr(py: Python<'p>, ptr: *mut PyObject) -> &'p Self[src]
unsafe fn from_borrowed_ptr_or_err(
py: Python<'p>,
ptr: *mut PyObject
) -> PyResult<&'p Self>[src]
py: Python<'p>,
ptr: *mut PyObject
) -> PyResult<&'p Self>
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> IntoPy<U> for T where
U: FromPy<T>, [src]
U: FromPy<T>,
impl<'py, T> PyDowncastImpl for T where
T: 'py + PyNativeType, [src]
T: 'py + PyNativeType,
unsafe fn unchecked_downcast(&PyAny) -> &T[src]
fn __private__(&self) -> PrivateMarker[src]
impl<'v, T> PyTryFrom<'v> for T where
T: PyDowncastImpl + PyTypeInfo + PyNativeType, [src]
T: PyDowncastImpl + PyTypeInfo + PyNativeType,
fn try_from<V>(V) -> Result<&'v T, PyDowncastError> where
V: Into<&'v PyAny>, [src]
V: Into<&'v PyAny>,
fn try_from_exact<V>(V) -> Result<&'v T, PyDowncastError> where
V: Into<&'v PyAny>, [src]
V: Into<&'v PyAny>,
unsafe fn try_from_unchecked<V>(V) -> &'v T where
V: Into<&'v PyAny>, [src]
V: Into<&'v PyAny>,
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.
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>,