Skip to main content

ResolveSink

Trait ResolveSink 

Source
pub trait ResolveSink<Op>
where Op: Operation,
{ // Required method fn resolve_request( &self, request: &mut Request<Op>, output: Op::Output, ) -> Result<(), ResolveError>; }
Expand description

Lets a core-local handler resolve a Request back through the router.

Core-side handlers (for example background workers that do async I/O) hold a Weak reference to something implementing this trait, typically the EffectRouter itself. When a handler finishes its work, it calls ResolveSink::resolve_request to resolve the original request and advance the runtime, so any follow-up effects are routed using the same policy.

The trait is generic over the Operation Op so a handler only depends on the single operation type it knows how to service, rather than the whole route set.

Required Methods§

Source

fn resolve_request( &self, request: &mut Request<Op>, output: Op::Output, ) -> Result<(), ResolveError>

Resolve a Request with an output value and advance the runtime.

§Errors

Returns an error if the request is not expected to be resolved by the underlying Core.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<App, RouteSet, Op> ResolveSink<Op> for EffectRouter<App, RouteSet>
where App: App, RouteSet: Routes<App> + Send + Sync + 'static, Op: Operation,