pub trait UListener: Send + Sync {
// Required method
fn on_receive<'life0, 'async_trait>(
&'life0 self,
msg: UMessage,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A handler for processing uProtocol messages.
Implementations contain the details for what should occur when a message is received.
Please refer to the uProtocol Transport Layer specification for details.
Required Methods§
Sourcefn on_receive<'life0, 'async_trait>(
&'life0 self,
msg: UMessage,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_receive<'life0, 'async_trait>(
&'life0 self,
msg: UMessage,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Performs some action on receipt of a message.
§Parameters
msg
- The message to process.
§Implementation hints
This function is expected to return almost immediately. If it does not, it could potentially block processing of succeeding messages. Long-running operations for processing a message should therefore be run on a separate thread.
Implementors§
impl UListener for MockUListener
A handler for processing uProtocol messages.
Implementations contain the details for what should occur when a message is received.
Please refer to the uProtocol Transport Layer specification for details.