pub trait Capability<Ev> {
    type Operation: Operation;
    type MappedSelf<MappedEv>;

    // Required method
    fn map_event<F, NewEvent>(&self, f: F) -> Self::MappedSelf<NewEvent>
       where F: Fn(NewEvent) -> Ev + Send + Sync + Copy + 'static,
             Ev: 'static,
             NewEvent: 'static;
}
Expand description

Implement Capability for your capability. This will allow mapping events when composing apps from submodules.

In the future this implementation will likely be provided by a derive macro.

Example:

impl<Ev> Capability<Ev> for Http<Ev> {
    type MappedSelf<MappedEv> = Http<MappedEv>;

    fn map_event<F, NewEvent>(&self, f: F) -> Self::MappedSelf<NewEvent>
    where
        F: Fn(NewEvent) -> Ef + Send + Sync + Copy + 'static,
        Ev: 'static,
        NewEvent: 'static,
    {
        Http::new(self.context.map_event(f))
    }
}

Required Associated Types§

Required Methods§

source

fn map_event<F, NewEvent>(&self, f: F) -> Self::MappedSelf<NewEvent>where F: Fn(NewEvent) -> Ev + Send + Sync + Copy + 'static, Ev: 'static, NewEvent: 'static,

Implementors§

source§

impl<Ev> Capability<Ev> for Render<Ev>