Struct cpython::PySequence [−][src]
pub struct PySequence(_);
Expand description
Represents a reference to a python object supporting the sequence protocol.
Implementations
Returns the number of objects in sequence. This is equivalent to Python len()
.
Return the concatenation of o1 and o2. Equivalent to python o1 + o2
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.
Return the concatenation of o1 and o2 on success. Equivalent to python o1 += o2
Return the result of repeating sequence object o count times.
Equivalent to python o *= count
NB: Python accepts negative counts; it empties the Sequence.
Return the ith element of the Sequence. Equivalent to python o[index]
Return the slice of sequence object o between begin and end.
This is the equivalent of the Python expression o[begin:end]
Assign object v to the ith element of o.
Equivalent to Python statement o[i] = v
Delete the ith element of object o.
Python statement del o[i]
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
Delete the slice in sequence object o from i1 to i2.
equivalent of the Python statement del o[i1:i2]
Return the number of occurrences of value in o, that is, return the number of keys for
which o[key] == value
Determine if o contains value. this is equivalent to the Python expression value in o
Return the first index i for which o[i] == value.
This is equivalent to the Python expression o.index(value)
Return a fresh list based on the Sequence.
Return a fresh tuple based on the Sequence.
Trait Implementations
Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.
Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.
Casts the Python object to PyObject.
fn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PySequence, PythonObjectDowncastError<'p>>
fn downcast_from<'p>(
py: Python<'p>,
obj: PyObject
) -> Result<PySequence, PythonObjectDowncastError<'p>>
Cast from PyObject to a concrete Python object type.
fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PySequence, PythonObjectDowncastError<'p>>
fn downcast_borrow_from<'a, 'p>(
py: Python<'p>,
obj: &'a PyObject
) -> Result<&'a PySequence, PythonObjectDowncastError<'p>>
Cast from PyObject to a concrete Python object type.
Identity conversion: allows using existing PyObject
instances where
T: ToPyObject
is expected.
type ObjectType = PySequence
Converts self into a Python object.
Converts self into a Python object. Read more