pub struct PySequence<'a> {
pub obj: &'a PyObject,
pub methods: &'static PySequenceMethods,
}
Fields§
§obj: &'a PyObject
§methods: &'static PySequenceMethods
Implementations§
Source§impl<'a> PySequence<'a>
impl<'a> PySequence<'a>
pub fn with_methods( obj: &'a PyObject, methods: &'static PySequenceMethods, ) -> Self
pub fn try_protocol(obj: &'a PyObject, vm: &VirtualMachine) -> PyResult<Self>
Source§impl PySequence<'_>
impl PySequence<'_>
pub fn check(&self) -> bool
pub fn find_methods(obj: &PyObject) -> Option<PointerSlot<PySequenceMethods>>
pub fn length_opt(self, vm: &VirtualMachine) -> Option<PyResult<usize>>
pub fn length(self, vm: &VirtualMachine) -> PyResult<usize>
pub fn concat(self, other: &PyObject, vm: &VirtualMachine) -> PyResult
pub fn repeat(self, n: isize, vm: &VirtualMachine) -> PyResult
pub fn inplace_concat(self, other: &PyObject, vm: &VirtualMachine) -> PyResult
pub fn inplace_repeat(self, n: isize, vm: &VirtualMachine) -> PyResult
pub fn get_item(self, i: isize, vm: &VirtualMachine) -> PyResult
pub fn set_item( self, i: isize, value: PyObjectRef, vm: &VirtualMachine, ) -> PyResult<()>
pub fn del_item(self, i: isize, vm: &VirtualMachine) -> PyResult<()>
pub fn get_slice( &self, start: isize, stop: isize, vm: &VirtualMachine, ) -> PyResult
pub fn set_slice( &self, start: isize, stop: isize, value: PyObjectRef, vm: &VirtualMachine, ) -> PyResult<()>
pub fn del_slice( &self, start: isize, stop: isize, vm: &VirtualMachine, ) -> PyResult<()>
pub fn tuple(&self, vm: &VirtualMachine) -> PyResult<PyTupleRef>
pub fn list(&self, vm: &VirtualMachine) -> PyResult<PyListRef>
pub fn count(&self, target: &PyObject, vm: &VirtualMachine) -> PyResult<usize>
pub fn index(&self, target: &PyObject, vm: &VirtualMachine) -> PyResult<usize>
pub fn extract<F, R>(&self, f: F, vm: &VirtualMachine) -> PyResult<Vec<R>>
pub fn contains(self, target: &PyObject, vm: &VirtualMachine) -> PyResult<bool>
Trait Implementations§
Source§impl<'a> Clone for PySequence<'a>
impl<'a> Clone for PySequence<'a>
Source§fn clone(&self) -> PySequence<'a>
fn clone(&self) -> PySequence<'a>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Traverse for PySequence<'_>
impl Traverse for PySequence<'_>
Source§fn traverse(&self, tracer_fn: &mut TraverseFn<'_>)
fn traverse(&self, tracer_fn: &mut TraverseFn<'_>)
impl
traverse()
with caution! Following those guideline so traverse doesn’t cause memory error!: Read moreimpl<'a> Copy for PySequence<'a>
Auto Trait Implementations§
impl<'a> Freeze for PySequence<'a>
impl<'a> !RefUnwindSafe for PySequence<'a>
impl<'a> !Send for PySequence<'a>
impl<'a> !Sync for PySequence<'a>
impl<'a> Unpin for PySequence<'a>
impl<'a> !UnwindSafe for PySequence<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more