Trait up_rust::communication::Subscriber  
source · pub trait Subscriber: Send + Sync {
    // Required methods
    fn subscribe<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic: &'life1 UUri,
        handler: Arc<dyn UListener>,
        subscription_change_handler: Option<Arc<dyn SubscriptionChangeHandler>>,
    ) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unsubscribe<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic: &'life1 UUri,
        handler: Arc<dyn UListener>,
    ) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}Expand description
A client for subscribing to topics.
Please refer to the Communication Layer API Specifications.
Required Methods§
sourcefn subscribe<'life0, 'life1, 'async_trait>(
    &'life0 self,
    topic: &'life1 UUri,
    handler: Arc<dyn UListener>,
    subscription_change_handler: Option<Arc<dyn SubscriptionChangeHandler>>,
) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
 
fn subscribe<'life0, 'life1, 'async_trait>(
    &'life0 self,
    topic: &'life1 UUri,
    handler: Arc<dyn UListener>,
    subscription_change_handler: Option<Arc<dyn SubscriptionChangeHandler>>,
) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
Registers a handler to invoke for messages that have been published to a given topic.
More than one handler can be registered for the same topic. The same handler can be registered for multiple topics.
§Arguments
- topic- The topic to subscribe to. The topic must not contain any wildcards.
- handler- The handler to invoke for each message that has been published to the topic.
- subscription_change_handler- A handler to invoke for any subscription state changes for the given topic.
§Errors
Returns an error if the listener cannot be registered.
sourcefn unsubscribe<'life0, 'life1, 'async_trait>(
    &'life0 self,
    topic: &'life1 UUri,
    handler: Arc<dyn UListener>,
) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
 
fn unsubscribe<'life0, 'life1, 'async_trait>(
    &'life0 self,
    topic: &'life1 UUri,
    handler: Arc<dyn UListener>,
) -> Pin<Box<dyn Future<Output = Result<(), RegistrationError>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
Unregisters a previously registered handler.
§Arguments
- topic- The topic that the handler had been registered for.
- handler- The handler to unregister.
§Errors
Returns an error if the listener cannot be unregistered.