Skip to main content

Context

Struct Context 

Source
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: Id

Implementations§

Source§

impl Context

Source

pub fn frame(&self) -> Id

Read the frame identity for local adapter calls.

Source

pub fn with<T: ContextDatum>( &self, key: &ContextKey<T>, value: T, ) -> Result<Self>

Derive values without extending identity or invocation lifetime.

Source

pub fn enter_execution(&self) -> Result<Self>

Retain the admitted isolated revision in this invocation’s private execution ancestry.

Source

pub fn value<T: ContextDatum>(&self, key: &ContextKey<T>) -> Result<Option<T>>

Read typed metadata while this invocation remains valid.

Source

pub fn check(&self) -> Result<()>

Reject an expired root, or a completed invocation or one its caller cancelled.

Source

pub fn cancel(&self) -> Result<()>

Signal root cancellation without releasing physical ownership.

Source

pub fn principal(&self) -> Result<String>

Read the identity retained by this root.

Source

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.

Source

pub fn invocation(&self) -> Result<Invocation>

Require an admitted call context for owner operations.

Source§

impl Context

Source

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

Source

pub fn get( &self, service: &str, key: Vec<String>, options: AcquisitionOptions, ) -> Result<Rc<Reference>>

Acquire a reference whose claim is revoked when this operation’s root ends.

Source§

impl Context

Source

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

pub fn orb<T: 'static>(&self) -> Result<Rc<T>>

Access the native environment shared by the currently entered orb.

Source

pub fn resource<T: 'static>(&self, name: &str) -> Result<Resource<T>>

Access a host-owned resource during an active operation.

Source§

impl Context

Source

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.

Trait Implementations§

Source§

impl Clone for Context

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.