pub trait HandleExt {
// Required methods
fn wait_for_event(self, timeout: Duration) -> Result<()>;
unsafe fn send_service_request(
self,
request: Vec<u32>,
expected_response_len: usize
) -> Result<Vec<u32>>;
}
Expand description
Extension trait for Handle
Required Methods§
sourcefn wait_for_event(self, timeout: Duration) -> Result<()>
fn wait_for_event(self, timeout: Duration) -> Result<()>
Wait for an event to fire. If the timeout is reached, an error is returned. You can use
[Error::is_timeout
] to check if the error is due to a timeout.
sourceunsafe fn send_service_request(
self,
request: Vec<u32>,
expected_response_len: usize
) -> Result<Vec<u32>>
unsafe fn send_service_request( self, request: Vec<u32>, expected_response_len: usize ) -> Result<Vec<u32>>
Send a service request to the handle.
The request vector must contain the command header and any parameters.
The request vector is overwritten with the response and returned.
The error in the response is checked and returned as a Result::Err
if the operation failed.
§Safety
This function is unsafe because it directly accesses the thread command buffer. If the request vector or the expected response length is incorrect, or the handle is not a service that accepts requests, the function may cause undefined behavior.