pub struct MockUListener { /* private fields */ }
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.
Implementations§
Source§impl MockUListener
impl MockUListener
Sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Validate that all current expectations for all methods have been satisfied, and discard them.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new mock object with no expectations.
This method will not be generated if the real struct
already has a new
method. However, it will be
generated if the struct implements a trait with a new
method. The trait’s new
method can still be called
like <MockX as TraitY>::new
Source§impl MockUListener
impl MockUListener
Sourcepub fn expect_on_receive(&mut self) -> &mut Expectation
pub fn expect_on_receive(&mut self) -> &mut Expectation
Create an Expectation
for mocking the on_receive
method
Trait Implementations§
Source§impl Debug for MockUListener
impl Debug for MockUListener
Source§impl Default for MockUListener
impl Default for MockUListener
Source§impl UListener for MockUListener
A handler for processing uProtocol messages.
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.
Source§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,
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.