pub struct Context {
pub config: Arc<Config>,
pub run_id: String,
/* private fields */
}Expand description
Per-run shared state handed to tasks.
Fields§
§config: Arc<Config>Immutable run configuration.
run_id: StringUnique id for this run.
Implementations§
Source§impl Context
impl Context
Sourcepub fn cancel_token(&self) -> &CancelToken
pub fn cancel_token(&self) -> &CancelToken
The cancellation token for this run.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the run has been cancelled.
Sourcepub fn set(&self, key: impl Into<String>, value: Value)
pub fn set(&self, key: impl Into<String>, value: Value)
Store a value on the blackboard, overwriting any existing entry.
Sourcepub fn get_as<T: DeserializeOwned>(&self, key: &str) -> Option<T>
pub fn get_as<T: DeserializeOwned>(&self, key: &str) -> Option<T>
Deserialize a blackboard value into a concrete type.
Auto Trait Implementations§
impl !Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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