pub struct RpcMuxClient<'a> { /* private fields */ }Expand description
Multi-slot RPC client.
Scans the slot array for an empty slot, writes a request, and polls that same slot for the server’s response.
Implementations§
Source§impl<'a> RpcMuxClient<'a>
impl<'a> RpcMuxClient<'a>
Sourcepub fn new(
lease: &'a MemLease,
num_slots: usize,
slot_payload_size: usize,
) -> Self
pub fn new( lease: &'a MemLease, num_slots: usize, slot_payload_size: usize, ) -> Self
Create a new mux client.
lease: shared memory lease backing the slot array.num_slots: number of slots (default:DEFAULT_NUM_SLOTS).slot_payload_size: max payload per slot (default:DEFAULT_SLOT_PAYLOAD_SIZE).
Sourcepub fn with_max_poll_iterations(self, n: u32) -> Self
pub fn with_max_poll_iterations(self, n: u32) -> Self
Set the maximum poll iterations before a call times out.
Sourcepub fn call(&self, method_id: u32, request: &[u8]) -> Result<Vec<u8>>
pub fn call(&self, method_id: u32, request: &[u8]) -> Result<Vec<u8>>
Perform an RPC call through the mux.
Finds a free slot, writes the request, and polls for the response.
§Errors
FabricError::CapacityExceeded– no free slot available or payload exceeds the per-slot capacity.FabricError::LeaseExpired– poll limit exceeded (timeout) or lease has expired.FabricError::Revoked– lease was explicitly revoked.FabricError::IoError(-102)– server returned ERROR status.
Auto Trait Implementations§
impl<'a> !Freeze for RpcMuxClient<'a>
impl<'a> !RefUnwindSafe for RpcMuxClient<'a>
impl<'a> !Send for RpcMuxClient<'a>
impl<'a> !Sync for RpcMuxClient<'a>
impl<'a> Unpin for RpcMuxClient<'a>
impl<'a> !UnwindSafe for RpcMuxClient<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more