pub struct PositionIterInternal<T> {
pub status: IterStatus<T>,
pub position: usize,
}Fields§
§status: IterStatus<T>§position: usizeImplementations§
Source§impl<T> PositionIterInternal<T>
impl<T> PositionIterInternal<T>
pub const fn new(obj: T, position: usize) -> Self
pub fn set_state<F>( &mut self, state: &PyObject, f: F, vm: &VirtualMachine, ) -> PyResult<()>
Sourcepub fn reduce<F, E>(
&self,
func: PyObjectRef,
active: F,
empty: E,
vm: &VirtualMachine,
) -> PyTupleRef
pub fn reduce<F, E>( &self, func: PyObjectRef, active: F, empty: E, vm: &VirtualMachine, ) -> PyTupleRef
Build a pickle-compatible reduce tuple.
func must be resolved before acquiring any lock that guards this
PositionIterInternal, so that the builtins lookup cannot trigger
reentrant iterator access and deadlock.
Sourcepub fn exhaust(&mut self) -> Option<T>
pub fn exhaust(&mut self) -> Option<T>
Mark this exhausted and hand back what it was holding, for the caller to
release once it has dropped the lock guarding this. Releasing it under
that lock would let a __del__ that iterates again deadlock.
Sourcepub fn next<F>(&mut self, f: F) -> (PyResult<PyIterReturn>, Option<T>)
pub fn next<F>(&mut self, f: F) -> (PyResult<PyIterReturn>, Option<T>)
Advance, along with what this was holding if the step exhausted it. See
Self::exhaust for why the caller is handed it rather than the drop
happening here; locked_next does the release for the common case.
Sourcepub fn rev_next<F>(&mut self, f: F) -> (PyResult<PyIterReturn>, Option<T>)
pub fn rev_next<F>(&mut self, f: F) -> (PyResult<PyIterReturn>, Option<T>)
Self::next walking backwards, exhausted once it steps off the front.
pub fn length_hint<F>(&self, f: F) -> usize
pub fn rev_length_hint<F>(&self, f: F) -> usize
Trait Implementations§
Source§impl<T: Debug> Debug for PositionIterInternal<T>
impl<T: Debug> Debug for PositionIterInternal<T>
Source§impl<T: Traverse> Traverse for PositionIterInternal<T>
impl<T: Traverse> Traverse for PositionIterInternal<T>
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 moreSource§fn clear(&mut self, _out: &mut Vec<PyObjectRef>)
fn clear(&mut self, _out: &mut Vec<PyObjectRef>)
Extract all owned child PyObjectRefs for circular reference resolution (tp_clear).
Called just before object deallocation to break circular references.
Default implementation does nothing.
Auto Trait Implementations§
impl<T> Freeze for PositionIterInternal<T>where
IterStatus<T>: Freeze,
impl<T> RefUnwindSafe for PositionIterInternal<T>where
IterStatus<T>: RefUnwindSafe,
impl<T> Send for PositionIterInternal<T>where
IterStatus<T>: Send,
impl<T> Sync for PositionIterInternal<T>where
IterStatus<T>: Sync,
impl<T> Unpin for PositionIterInternal<T>where
IterStatus<T>: Unpin,
impl<T> UnsafeUnpin for PositionIterInternal<T>where
IterStatus<T>: UnsafeUnpin,
impl<T> UnwindSafe for PositionIterInternal<T>where
IterStatus<T>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Helper for T
Source§impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
fn imaginary_into(self) -> U
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