Trait pemmican::plugins::Plugin
[−]
[src]
pub trait Plugin<S: Send + Sync + 'static, E: 'static>: Send + Sync { fn before_handler(&self, request: &mut Request); fn after_handler(
&self,
future: Box<Future<Item = PluginData<S>, Error = E>>
) -> Box<Future<Item = PluginData<S>, Error = E>>; }
A plugable component, run on every request (for which a valid route exists)
Required Methods
fn before_handler(&self, request: &mut Request)
This runs before the handler, and potentially modifies the request
fn after_handler(
&self,
future: Box<Future<Item = PluginData<S>, Error = E>>
) -> Box<Future<Item = PluginData<S>, Error = E>>
&self,
future: Box<Future<Item = PluginData<S>, Error = E>>
) -> Box<Future<Item = PluginData<S>, Error = E>>
This runs after the handler. This must return a future that uses the passed in
future, returning the modified future, (e.g. perhaps using and_then)
This potentially modifies the Response (available through the data
parameter).