Skip to main content

Context

Struct Context 

Source
pub struct Context { /* private fields */ }
Expand description

What a method knows about the call it answers.

Implementations§

Source§

impl Context

Source

pub fn try_new( run: &str, call: &str, spec: &TypeSpec, schema: Option<Json>, types: Option<Json>, cancelled: Arc<AtomicBool>, ) -> Result<Context, DecodeError>

Validates the complete call views before making an author context.

Source

pub fn types(&self) -> Option<&ValidatedTypes>

The admitted concrete type description, if this Tool is generic.

Source

pub fn codec(&self, name: &str) -> Result<ContextCodec, DecodeError>

A generic binding’s owned codec, when that binding crosses the boundary.

Source

pub fn argument_codec(&self, name: &str) -> Result<ContextCodec, DecodeError>

An argument’s owned concrete codec.

Source

pub fn success_codec(&self) -> Result<ContextCodec, DecodeError>

The owned success codec.

Source

pub fn failure_codec(&self) -> Result<ContextCodec, DecodeError>

The owned failure codec.

Source

pub fn run(&self) -> &str

The run’s id.

Source

pub fn call(&self) -> &str

The call’s id, which a call sent again after a crash keeps.

Source

pub fn schema(&self) -> Option<&Json>

For a generic Tool, the schema of the success type the caller expects.

Source

pub fn log(&self, level: &str, message: &str) -> Result<()>

Writes one call-correlated operational log record outside protocol stdout.

Source

pub fn cancelled(&self) -> bool

Whether the host asked to stop work on this call. It proves nothing either way.

Source

pub fn cancel(&self)

Asks to stop work on this call, as a cancel does.

Source§

impl Context

Source

pub fn resource<T: Send + Sync + 'static>(&self) -> Option<Arc<T>>

Retrieves the initialized process resource by its actual Rust type.

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
Source§

impl Debug for Context

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> Same for T

Source§

type Output = T

Should always be Self
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.