pub struct Dispatcher { /* private fields */ }Expand description
Decides which proof answers a call, and runs it.
Implementations§
Source§impl Dispatcher
impl Dispatcher
Sourcepub fn new(ws: Arc<CheckedWorkspace>, registry: Arc<Registry>) -> Self
pub fn new(ws: Arc<CheckedWorkspace>, registry: Arc<Registry>) -> Self
A dispatcher over a workspace and what has been registered against it.
Sourcepub fn workers(&self) -> &Workers
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.
Sourcepub fn with_options(self, options: Options) -> Self
pub fn with_options(self, options: Options) -> Self
The same, with different checking.
Sourcepub fn workspace(&self) -> &CheckedWorkspace
pub fn workspace(&self) -> &CheckedWorkspace
The workspace being dispatched against.
Sourcepub fn candidates(
&self,
sig: &QualifiedName,
policy: &Policy,
) -> Vec<&Implementation>
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.
Sourcepub fn call<'a>(
&'a self,
sig: &'a QualifiedName,
args: Vec<Value>,
policy: &'a Policy,
) -> BoxFuture<'a, Result<Invocation, DispatchError>>
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.
Sourcepub fn call_at<'a>(
&'a self,
sig: &'a QualifiedName,
type_args: &'a [Type],
args: Vec<Value>,
policy: &'a Policy,
) -> BoxFuture<'a, Result<Invocation, DispatchError>>
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.