pub struct PendingRequests { /* private fields */ }Expand description
Tracks pending server-to-client requests.
When the server sends a request to the client, it registers a response sender here. When a response arrives, the dispatcher routes it to the correct sender.
Implementations§
Source§impl PendingRequests
impl PendingRequests
Sourcepub fn next_request_id(&self) -> RequestId
pub fn next_request_id(&self) -> RequestId
Generates a new unique request ID.
Sourcepub fn register(&self, id: RequestId) -> Receiver<Result<Value, JsonRpcError>>
pub fn register(&self, id: RequestId) -> Receiver<Result<Value, JsonRpcError>>
Registers a pending request and returns a receiver for the response.
Sourcepub fn route_response(&self, response: &JsonRpcResponse) -> bool
pub fn route_response(&self, response: &JsonRpcResponse) -> bool
Routes a response to the appropriate pending request.
Returns true if the response was routed, false if no matching request was found.
Sourcepub fn remove(&self, id: &RequestId)
pub fn remove(&self, id: &RequestId)
Removes a pending request (e.g., on timeout or cancellation).
Sourcepub fn cancel_all(&self)
pub fn cancel_all(&self)
Cancels all pending requests with a connection closed error.
Trait Implementations§
Source§impl Debug for PendingRequests
impl Debug for PendingRequests
Auto Trait Implementations§
impl !Freeze for PendingRequests
impl RefUnwindSafe for PendingRequests
impl Send for PendingRequests
impl Sync for PendingRequests
impl Unpin for PendingRequests
impl UnwindSafe for PendingRequests
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).