Trait bones_framework::prelude::piccolo::callback::Sequence

pub trait Sequence<'gc>: Collect {
    // Required method
    fn poll(
        &mut self,
        ctx: Context<'gc>,
        exec: Execution<'gc, '_>,
        stack: Stack<'gc, '_>,
    ) -> Result<SequencePoll<'gc>, Error<'gc>>;

    // Provided method
    fn error(
        &mut self,
        _ctx: Context<'gc>,
        _exec: Execution<'gc, '_>,
        error: Error<'gc>,
        _stack: Stack<'gc, '_>,
    ) -> Result<SequencePoll<'gc>, Error<'gc>> { ... }
}

Required Methods§

fn poll( &mut self, ctx: Context<'gc>, exec: Execution<'gc, '_>, stack: Stack<'gc, '_>, ) -> Result<SequencePoll<'gc>, Error<'gc>>

Called when a Sequence is first run with the stack unchanged from the returned Callback that spawned it.

If a sub-function is called and succeeds, this will be called when that function finishes successfully with its return values.

If the Sequence yields values, this will suspend the containing coroutine and Sequence::poll will be called again with the resume parameters.

Provided Methods§

fn error( &mut self, _ctx: Context<'gc>, _exec: Execution<'gc, '_>, error: Error<'gc>, _stack: Stack<'gc, '_>, ) -> Result<SequencePoll<'gc>, Error<'gc>>

Called if a sub-function errors to handle the error, or if a Sequence has yielded and the containing coroutine is resumed with an error.

Implementors§