#[non_exhaustive]pub struct StepContext { /* private fields */ }Expand description
Context passed to step bodies.
StepContext deliberately does not expose any durable operations.
This provides compile-time enforcement of the rule that durable
operations cannot be nested inside step bodies: attempting to call
a durable operation method inside a step body is a type error.
Use tracing macros for logging inside steps: the SDK-created
operation span automatically attaches execution context fields.
§Examples
use aws_durable_execution_sdk as durable;
async fn handler(
_event: serde_json::Value,
ctx: durable::DurableContext,
) -> Result<String, durable::BoxError> {
let result = ctx.step(|step_ctx: durable::StepContext| async move {
// step_ctx has no durable operations: type-system enforced
tracing::info!("inside step");
Ok("done".to_owned())
}).await?;
Ok(result)
}Implementations§
Trait Implementations§
Source§impl Clone for StepContext
impl Clone for StepContext
Auto Trait Implementations§
impl Forget for StepContext
impl Freeze for StepContext
impl Move for StepContext
impl RefUnwindSafe for StepContext
impl Send for StepContext
impl Sync for StepContext
impl Unpin for StepContext
impl UnsafeUnpin for StepContext
impl UnwindSafe for StepContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreCreates a shared type from an unshared type.