pub struct MockRequestHandler { /* private fields */ }
Expand description
A handler for processing incoming RPC requests.
Implementations§
Source§impl MockRequestHandler
impl MockRequestHandler
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 MockRequestHandler
impl MockRequestHandler
Sourcepub fn expect_handle_request(&mut self) -> &mut Expectation
pub fn expect_handle_request(&mut self) -> &mut Expectation
Create an Expectation
for mocking the handle_request
method
Trait Implementations§
Source§impl Debug for MockRequestHandler
impl Debug for MockRequestHandler
Source§impl Default for MockRequestHandler
impl Default for MockRequestHandler
Source§impl RequestHandler for MockRequestHandler
A handler for processing incoming RPC requests.
impl RequestHandler for MockRequestHandler
A handler for processing incoming RPC requests.
Source§fn handle_request<'life0, 'life1, 'async_trait>(
&'life0 self,
resource_id: u16,
message_attributes: &'life1 UAttributes,
request_payload: Option<UPayload>,
) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_request<'life0, 'life1, 'async_trait>(
&'life0 self,
resource_id: u16,
message_attributes: &'life1 UAttributes,
request_payload: Option<UPayload>,
) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles a request to invoke a method with given input parameters.
Implementations MUST NOT block the calling thread. Long running computations should be performed on a separate worker thread, yielding on the calling thread.
§Arguments
resource_id
- The resource identifier of the method to invoke.message_attributes
- Any metadata that is associated with the request message.request_payload
- The raw payload that contains the input data for the method.
§Returns
the output data generated by the method.
§Errors
Returns an error if the request could not be processed successfully.