pub struct Context {
pub root: Id,
/* private fields */
}Expand description
Contexts are issued by a host, and become unusable when their root or invocation ends.
Fields§
§root: IdImplementations§
Source§impl Context
impl Context
Sourcepub fn with<T: ContextDatum>(
&self,
key: &ContextKey<T>,
value: T,
) -> Result<Self>
pub fn with<T: ContextDatum>( &self, key: &ContextKey<T>, value: T, ) -> Result<Self>
Derive values without extending identity or invocation lifetime.
Sourcepub fn enter_execution(&self) -> Result<Self>
pub fn enter_execution(&self) -> Result<Self>
Retain the admitted isolated revision in this invocation’s private execution ancestry.
Sourcepub fn value<T: ContextDatum>(&self, key: &ContextKey<T>) -> Result<Option<T>>
pub fn value<T: ContextDatum>(&self, key: &ContextKey<T>) -> Result<Option<T>>
Read typed metadata while this invocation remains valid.
Sourcepub fn check(&self) -> Result<()>
pub fn check(&self) -> Result<()>
Reject an expired root, or a completed invocation or one its caller cancelled.
Sourcepub fn cancel(&self) -> Result<()>
pub fn cancel(&self) -> Result<()>
Signal root cancellation without releasing physical ownership.
Sourcepub fn address(&self) -> Result<Address>
pub fn address(&self) -> Result<Address>
Read the canonical address of the object running this invocation, as
Declaration::address reads it while the object declares; in the opener or closer of an
object’s resource, the address of that object.
Sourcepub fn invocation(&self) -> Result<Invocation>
pub fn invocation(&self) -> Result<Invocation>
Require an admitted call context for owner operations.
Source§impl Context
impl Context
Sourcepub fn signal(&self) -> Cancellation
pub fn signal(&self) -> Cancellation
Observe cancellation of this operation’s root, including host shutdown. An entered invocation’s signal also fires when its caller cancels that invocation (or one it descends from); that never cancels the root or sibling calls.
Source§impl Context
impl Context
Sourcepub async fn get_wait(
&self,
service: &str,
key: Vec<String>,
options: AcquisitionOptions,
) -> Result<Rc<Reference>>
pub async fn get_wait( &self, service: &str, key: Vec<String>, options: AcquisitionOptions, ) -> Result<Rc<Reference>>
Acquire under this root after the exact previous instance physically closes.
Cancellation or root expiry ends only this wait; it never interrupts the old cleanup.
The principal, context and admission requirements are checked again on every attempt.
Use Reference::ready separately to await the new instance’s activation.
Source§impl Context
impl Context
Sourcepub fn log(
&self,
level: impl Into<String>,
message: impl Into<String>,
) -> Result<()>
pub fn log( &self, level: impl Into<String>, message: impl Into<String>, ) -> Result<()>
Hand a record to the host’s log observer, attributed to the Orb running this invocation, or, in a resource’s opener or closer, to the Orb owning the resource; without an observer it is dropped. Writing needs no admission: a cancelled call still logs. An observer that panics does not interrupt the call.