[−][src]Struct pyo3::types::PySequence
Represents a reference to a python object supporting the sequence protocol.
Methods
impl PySequence
[src]
pub fn len(&self) -> PyResult<isize>
[src]
Returns the number of objects in sequence. This is equivalent to Python len()
.
pub fn is_empty(&self) -> PyResult<bool>
[src]
pub fn concat(&self, other: &PySequence) -> PyResult<&PySequence>
[src]
Return the concatenation of o1 and o2. Equivalent to python o1 + o2
pub fn repeat(&self, count: isize) -> PyResult<&PySequence>
[src]
Return the result of repeating sequence object o count times.
Equivalent to python o * count
NB: Python accepts negative counts; it returns an empty Sequence.
pub fn in_place_concat(&self, other: &PySequence) -> PyResult<()>
[src]
Concatenate of o1 and o2 on success. Equivalent to python o1 += o2
pub fn in_place_repeat(&self, count: isize) -> PyResult<()>
[src]
Repeate sequence object o count times and store in self.
Equivalent to python o *= count
NB: Python accepts negative counts; it empties the Sequence.
pub fn get_item(&self, index: isize) -> PyResult<&PyAny>
[src]
Return the ith element of the Sequence. Equivalent to python o[index]
pub fn get_slice(&self, begin: isize, end: isize) -> PyResult<&PyAny>
[src]
Return the slice of sequence object o between begin and end.
This is the equivalent of the Python expression o[begin:end]
pub fn set_item<I>(&self, i: isize, item: I) -> PyResult<()> where
I: ToBorrowedObject,
[src]
I: ToBorrowedObject,
Assign object v to the ith element of o.
Equivalent to Python statement o[i] = v
pub fn del_item(&self, i: isize) -> PyResult<()>
[src]
Delete the ith element of object o.
Python statement del o[i]
pub fn set_slice(&self, i1: isize, i2: isize, v: &PyAny) -> PyResult<()>
[src]
Assign the sequence object v to the slice in sequence object o from i1 to i2.
This is the equivalent of the Python statement o[i1:i2] = v
pub fn del_slice(&self, i1: isize, i2: isize) -> PyResult<()>
[src]
Delete the slice in sequence object o from i1 to i2.
equivalent of the Python statement del o[i1:i2]
pub fn count<V>(&self, value: V) -> PyResult<usize> where
V: ToBorrowedObject,
[src]
V: ToBorrowedObject,
Return the number of occurrences of value in o, that is, return the number of keys for
which o[key] == value
pub fn contains<V>(&self, value: V) -> PyResult<bool> where
V: ToBorrowedObject,
[src]
V: ToBorrowedObject,
Determine if o contains value. this is equivalent to the Python expression value in o
pub fn index<V>(&self, value: V) -> PyResult<usize> where
V: ToBorrowedObject,
[src]
V: ToBorrowedObject,
Return the first index i
for which o[i] == value
.
This is equivalent to the Python expression o.index(value)
pub fn list(&self) -> PyResult<&PyList>
[src]
Return a fresh list based on the Sequence.
pub fn tuple(&self) -> PyResult<&PyTuple>
[src]
Return a fresh tuple based on the Sequence.
Trait Implementations
impl AsPyPointer 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>
fn try_from_mut<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v mut PySequence, PyDowncastError>
[src]
value: V
) -> Result<&'v mut PySequence, PyDowncastError>
fn try_from_mut_exact<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v mut PySequence, PyDowncastError>
[src]
value: V
) -> Result<&'v mut PySequence, PyDowncastError>
unsafe fn try_from_unchecked<V: Into<&'v PyAny>>(value: V) -> &'v PySequence
[src]
unsafe fn try_from_mut_unchecked<V: Into<&'v PyAny>>(
value: V
) -> &'v mut PySequence
[src]
value: V
) -> &'v mut PySequence
impl PyNativeType for PySequence
[src]
impl PartialEq<PySequence> for PySequence
[src]
fn eq(&self, o: &PySequence) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl AsRef<PyAny> for PySequence
[src]
Auto Trait Implementations
impl Unpin for PySequence
impl Sync for PySequence
impl Send for PySequence
impl RefUnwindSafe for PySequence
impl UnwindSafe for PySequence
Blanket Implementations
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,