pub struct SuspendBuilder<'a, T> { /* private fields */ }Expand description
Builder for a suspend point with optional status message.
Created by Context::suspend. Implements IntoFuture so it can
be .awaited directly or chained with .status().
§Examples
use memable::{Context, EngineError, SuspendPoint};
const WAIT: SuspendPoint<String> = SuspendPoint::new("wait:v1");
const APPROVAL: SuspendPoint<bool> = SuspendPoint::new("approval:v1");
async fn workflow(ctx: Context) -> Result<(), EngineError> {
// Simple suspend — status defaults to the step key.
let payload: String = ctx.suspend(&WAIT).await?;
// Suspend with custom status message.
let approved: bool = ctx.suspend(&APPROVAL)
.status("Waiting for manager approval")
.await?;
Ok(())
}Implementations§
Source§impl<'a, T> SuspendBuilder<'a, T>
impl<'a, T> SuspendBuilder<'a, T>
Trait Implementations§
Source§impl<'a, T> IntoFuture for SuspendBuilder<'a, T>
impl<'a, T> IntoFuture for SuspendBuilder<'a, T>
Source§type Output = Result<T, EngineError>
type Output = Result<T, EngineError>
The output that the future will produce on completion.
Source§type IntoFuture = Pin<Box<dyn Future<Output = <SuspendBuilder<'a, T> as IntoFuture>::Output> + Send + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = <SuspendBuilder<'a, T> as IntoFuture>::Output> + Send + 'a>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl<'a, T> Freeze for SuspendBuilder<'a, T>
impl<'a, T> !RefUnwindSafe for SuspendBuilder<'a, T>
impl<'a, T> Send for SuspendBuilder<'a, T>where
T: Send,
impl<'a, T> Sync for SuspendBuilder<'a, T>where
T: Sync,
impl<'a, T> Unpin for SuspendBuilder<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for SuspendBuilder<'a, T>
impl<'a, T> !UnwindSafe for SuspendBuilder<'a, T>
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