Spec

Trait Spec 

Source
pub trait Spec: Send + Sync {
    type Topic: Send + Sync + Clone + Eq + PartialEq + Ord + PartialOrd + Hash + DeserializeOwned + Serialize;
    type Event: Event<Topic = Self::Topic> + Send + Sync + Eq + PartialEq + DeserializeOwned + Serialize;
    type SubscriptionId: Clone + Default + Eq + PartialEq + Ord + PartialOrd + Hash + Send + Sync + DeserializeOwned + Serialize;
    type Context;

    // Required methods
    fn new_instance(context: Self::Context) -> Arc<Self>
       where Self: Sized;
    fn fetch_events<'life0, 'async_trait>(
        self: &'life0 Arc<Self>,
        topics: Vec<<Self::Event as Event>::Topic>,
        reply_to: Subscriber<Self>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: Sized + 'async_trait,
             'life0: 'async_trait;
}
Expand description

Pubsub settings

Required Associated Types§

Source

type Topic: Send + Sync + Clone + Eq + PartialEq + Ord + PartialOrd + Hash + DeserializeOwned + Serialize

Topic

Source

type Event: Event<Topic = Self::Topic> + Send + Sync + Eq + PartialEq + DeserializeOwned + Serialize

Event

Source

type SubscriptionId: Clone + Default + Eq + PartialEq + Ord + PartialOrd + Hash + Send + Sync + DeserializeOwned + Serialize

Subscription Id

Source

type Context

Create a new context

Required Methods§

Source

fn new_instance(context: Self::Context) -> Arc<Self>
where Self: Sized,

Create a new instance from a given context

Source

fn fetch_events<'life0, 'async_trait>( self: &'life0 Arc<Self>, topics: Vec<<Self::Event as Event>::Topic>, reply_to: Subscriber<Self>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sized + 'async_trait, 'life0: 'async_trait,

Callback function that is called on new subscriptions, to back-fill optionally the previous events

Implementors§