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).
Implementations on Foreign Types
impl<'a, S: Send + Sync + 'static, E: 'static, T: Send + Sync + Plugin<S, E>> Plugin<S, E> for &'a T
[src]
fn before_handler(&self, request: &mut Request)
[src]
fn after_handler(
&self,
future: Box<Future<Item = PluginData<S>, Error = E>>
) -> Box<Future<Item = PluginData<S>, Error = E>>
[src]
&self,
future: Box<Future<Item = PluginData<S>, Error = E>>
) -> Box<Future<Item = PluginData<S>, Error = E>>
Implementors
impl<S: Send + Sync + 'static, E: 'static> Plugin<S, E> for PageVisits