Trait up_rust::communication::RequestHandler
source · pub trait RequestHandler: Send + Sync {
// Required method
fn handle_request<'life0, 'async_trait>(
&'life0 self,
resource_id: u16,
request_payload: Option<UPayload>,
) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A handler for processing incoming RPC requests.
Required Methods§
sourcefn handle_request<'life0, 'async_trait>(
&'life0 self,
resource_id: u16,
request_payload: Option<UPayload>,
) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_request<'life0, 'async_trait>(
&'life0 self,
resource_id: u16,
request_payload: Option<UPayload>,
) -> Pin<Box<dyn Future<Output = Result<Option<UPayload>, ServiceInvocationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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.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.