Skip to main content

Routes

Trait Routes 

Source
pub trait Routes<App>: Sized + Clone
where App: App,
{ // Required method fn new(router: Weak<EffectRouter<App, Self>>) -> Self; }
Expand description

A set of effect handlers (“routes”) owned by an EffectRouter.

Implement this on a type that groups together the individual routes your app needs (for example a Serialized lane plus one or more Parked lanes and core-local handlers). The router calls Routes::new while it is being constructed, handing over a Weak reference to itself so each route can later resolve requests and advance the runtime.

The type must be Clone because a clone is given to the routing closure built in EffectRouter::new; routes are typically wrapped in Arc so cloning is cheap and shares the same underlying handlers.

Required Methods§

Source

fn new(router: Weak<EffectRouter<App, Self>>) -> Self

Construct the route set, given a Weak handle to the router that will own it.

The handle is Weak to avoid a reference cycle with the Arc holding the router; routes upgrade it on demand when they need to resolve a request.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§