pub struct TransitionCtx { /* private fields */ }Expand description
What a guard or an effect sees of the run: who, why, and the input and metadata given with it.
Implementations§
Source§impl TransitionCtx
impl TransitionCtx
Sourcepub fn new(actor: Option<AuthUser>) -> Self
pub fn new(actor: Option<AuthUser>) -> Self
A context for actor (None for a system run), with no reason, no
input and no metadata.
Sourcepub fn with_reason(self, reason: impl Into<String>) -> Self
pub fn with_reason(self, reason: impl Into<String>) -> Self
Sets the reason.
Sourcepub fn with_input(self, input: Value) -> Self
pub fn with_input(self, input: Value) -> Self
Sets the input guards and effects read with TransitionCtx::input.
Sourcepub fn actor(&self) -> Option<&AuthUser>
pub fn actor(&self) -> Option<&AuthUser>
The user running the transition; None for a system run.
Sourcepub fn input_as<T: DeserializeOwned>(&self) -> Result<T, String>
pub fn input_as<T: DeserializeOwned>(&self) -> Result<T, String>
The input, read as T.
Trait Implementations§
Source§impl Clone for TransitionCtx
impl Clone for TransitionCtx
Auto Trait Implementations§
impl !Freeze for TransitionCtx
impl !RefUnwindSafe for TransitionCtx
impl !UnwindSafe for TransitionCtx
impl Send for TransitionCtx
impl Sync for TransitionCtx
impl Unpin for TransitionCtx
impl UnsafeUnpin for TransitionCtx
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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