pub enum StartResult {
Created(Ctx),
Attached(Ctx),
}Expand description
Result of Ctx::start / Ctx::start_with_handler / Ctx::start_with_timeout.
Distinguishes whether a new workflow was created from scratch or an existing RUNNING workflow was attached to (idempotent start).
ⓘ
match Ctx::start(&db, "my-workflow", None).await? {
StartResult::Created(ctx) => { /* fresh run */ },
StartResult::Attached(ctx) => { /* resumed existing RUNNING task */ },
}
// Or just unwrap the Ctx when you don't care which variant:
let ctx = Ctx::start(&db, "my-workflow", None).await?.into_ctx();Variants§
Created(Ctx)
A fresh workflow task was inserted and started.
Attached(Ctx)
An existing RUNNING workflow with the same name was found and reused.
Implementations§
Source§impl StartResult
impl StartResult
Sourcepub fn is_created(&self) -> bool
pub fn is_created(&self) -> bool
Returns true if a new workflow task was created.
Sourcepub fn is_attached(&self) -> bool
pub fn is_attached(&self) -> bool
Returns true if an existing RUNNING workflow was reused.
Auto Trait Implementations§
impl !Freeze for StartResult
impl !RefUnwindSafe for StartResult
impl Send for StartResult
impl Sync for StartResult
impl Unpin for StartResult
impl UnsafeUnpin for StartResult
impl !UnwindSafe for StartResult
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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