Skip to main content

Dispatcher

Struct Dispatcher 

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

Decides which proof answers a call, and runs it.

Implementations§

Source§

impl Dispatcher

Source

pub fn new(ws: Arc<CheckedWorkspace>, registry: Arc<Registry>) -> Self

A dispatcher over a workspace and what has been registered against it.

Source

pub fn workers(&self) -> &Workers

The workers this dispatcher is keeping alive.

Exposed so a program can stop them at a moment of its choosing; dropping the dispatcher stops them anyway.

Source

pub fn with_options(self, options: Options) -> Self

The same, with different checking.

Source

pub fn workspace(&self) -> &CheckedWorkspace

The workspace being dispatched against.

Source

pub fn registry(&self) -> &Registry

What is registered.

Source

pub fn candidates( &self, sig: &QualifiedName, policy: &Policy, ) -> Vec<&Implementation>

Every proof that would answer this proposition, best first under the given policy.

Useful on its own: it is what “why did it choose that one” looks like before anything has run.

Source

pub fn call<'a>( &'a self, sig: &'a QualifiedName, args: Vec<Value>, policy: &'a Policy, ) -> BoxFuture<'a, Result<Invocation, DispatchError>>

Calls a proposition, choosing a proof by policy.

For a generic proposition use Dispatcher::call_at: this is the same call with no type arguments, which is only enough when there is nothing to bind.

Source

pub fn call_at<'a>( &'a self, sig: &'a QualifiedName, type_args: &'a [Type], args: Vec<Value>, policy: &'a Policy, ) -> BoxFuture<'a, Result<Invocation, DispatchError>>

Calls a generic proposition at particular types.

reverse<T> says something about every T; reverse<i64> is the claim a list of integers can actually be checked against. The type arguments bind the proposition’s parameters in order, and both sides of the boundary are then checked against the instantiated signature. The proof itself is not told: a proof of a generic proposition is one that did not need to know.

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> 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, 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.