Trait rosrust::api::handlers::SubscriptionHandler

source ·
pub trait SubscriptionHandler<T>: Send + 'static {
    // Required methods
    fn connection(&mut self, headers: HashMap<String, String>);
    fn message(&mut self, message: T, callerid: &str);
}
Expand description

Handles all calls involved with a subscription

Each subscription is done in one thread, so there is no synchronization necessary between these calls.

Required Methods§

source

fn connection(&mut self, headers: HashMap<String, String>)

Called before any message is accepted from a certain caller ID

Contains the headers for handling the specific connection

source

fn message(&mut self, message: T, callerid: &str)

Called upon receiving any message

Implementors§

source§

impl<T, F, G> SubscriptionHandler<T> for CallbackSubscriptionHandler<T, F, G>
where T: Message, F: Fn(T, &str) + Send + 'static, G: Fn(HashMap<String, String>) + Send + 'static,