pub struct PythonGenerator<T, D> { /* private fields */ }Expand description
Python send/throw/close policy backed by the shared resumable frame.
Implementations§
Source§impl<T, D> PythonGenerator<T, D>where
D: FnMut(ResumePacket<T, PythonException>, &mut StepBudget) -> Result<ResumeResult<T, T, PythonException>, FrameError>,
impl<T, D> PythonGenerator<T, D>where
D: FnMut(ResumePacket<T, PythonException>, &mut StepBudget) -> Result<ResumeResult<T, T, PythonException>, FrameError>,
Sourcepub fn new(limits: FrameLimits, driver: D) -> Self
pub fn new(limits: FrameLimits, driver: D) -> Self
Construct a bounded generator. This supplies no scheduler or event loop.
Sourcepub fn start(&mut self) -> Result<PythonGeneratorStep<T>, PythonGeneratorError>
pub fn start(&mut self) -> Result<PythonGeneratorStep<T>, PythonGeneratorError>
Start execution and advance to the first yield.
Sourcepub fn send(
&mut self,
value: T,
) -> Result<PythonGeneratorStep<T>, PythonGeneratorError>
pub fn send( &mut self, value: T, ) -> Result<PythonGeneratorStep<T>, PythonGeneratorError>
Send a value into the suspended generator.
Sourcepub fn throw(
&mut self,
error: PythonException,
) -> Result<PythonGeneratorStep<T>, PythonGeneratorError>
pub fn throw( &mut self, error: PythonException, ) -> Result<PythonGeneratorStep<T>, PythonGeneratorError>
Throw an exception into the suspended generator.
Sourcepub fn close(&mut self) -> Result<PythonGeneratorStep<T>, PythonGeneratorError>
pub fn close(&mut self) -> Result<PythonGeneratorStep<T>, PythonGeneratorError>
Close the suspended generator and run its driver cleanup.
Auto Trait Implementations§
impl<T, D> Freeze for PythonGenerator<T, D>where
D: Freeze,
impl<T, D> RefUnwindSafe for PythonGenerator<T, D>where
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, D> Send for PythonGenerator<T, D>
impl<T, D> Sync for PythonGenerator<T, D>
impl<T, D> Unpin for PythonGenerator<T, D>
impl<T, D> UnsafeUnpin for PythonGenerator<T, D>where
D: UnsafeUnpin,
impl<T, D> UnwindSafe for PythonGenerator<T, D>where
D: UnwindSafe,
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