pub struct Request { /* private fields */ }
Expand description
Contains route to the RPC endpoint, and received payload
Implementations§
source§impl Request
impl Request
pub fn route(&self) -> &[u8] ⓘ
pub fn route_cstr(&self) -> Result<&CStr, impl Error>
pub fn payload(&self) -> &[u8] ⓘ
sourcepub unsafe fn payload_cstr_unchecked(&self) -> &CStr
pub unsafe fn payload_cstr_unchecked(&self) -> &CStr
In this function, the last byte is guaranteed to be NULL, but there is no guarantee that there are no NULL bytes in the middle. To avoid unnecessarily iterating over all the bytes, the function is marked as unsafe and does not perform any verification logic.
pub fn request_id(&self) -> u128
pub async fn reply<'a, T: AsRef<[u8]> + ?Sized + 'a>( self, payload: impl IntoIterator<Item = &'a T> ) -> Result<usize>
pub async fn error<'a, T: AsRef<[u8]> + ?Sized + 'a>( self, errc: RepCode, payload: impl IntoIterator<Item = &'a T> ) -> Result<usize>
pub async fn user_error<'a, T: AsRef<[u8]> + ?Sized + 'a>( self, payload: impl IntoIterator<Item = &'a T> ) -> Result<usize>
pub async fn user_error_by<T: Display>(self, error: T) -> Result<usize>
pub async fn error_no_route(self) -> Result<usize>
Trait Implementations§
source§impl Drop for Request
impl Drop for Request
source§fn drop(&mut self)
fn drop(&mut self)
In the rpc-it
library, all data transmission is based on direct transmission
polling of the low-level crate::AsyncFrameWrite
handler.
No I/O operations that rely on async
or blocking can be performed within
the Drop
handler, so handling of unprocessed request responses is handed off
to worker tasks.