Trait message_worker::Context[][src]

pub trait Context: 'static { }
Expand description

This trait needs to be implemented by the item you’re using as the state for the listener.

For example, if the listener has no state you can simply go:

use message_worker::Context;
struct EmptyCtx;
impl Context for EmptyCtx {}

EmptyCtx can now be used as the context for your listeners. For mutability inside a Context you can use RefCells. The Message Worker runtime guarantees that it will never attempt to access your context in parallel from one listener.

Implementors