pub struct RequestQueue<I, O> {
pub incoming: IncomingRequests<I>,
pub outgoing: OutgoingRequests<O>,
}Expand description
Combined request queue tracking both incoming and outgoing requests.
This is the primary type for managing LSP request-response correlation. It provides separate tracking for:
incoming: Requests received from clients that need responsesoutgoing: Requests sent to clients that are awaiting responses
§Type Parameters
I: Metadata type for incoming requests (e.g., handler context)O: Response type for outgoing requests
§Example
use lsp_server_tokio::{RequestQueue, RequestId};
use tokio_util::sync::CancellationToken;
// Create a queue for a server that tracks method names for incoming
// requests and expects JSON responses for outgoing requests
let mut queue: RequestQueue<String, serde_json::Value> = RequestQueue::new();
// Track incoming request with cancellation token
let token = CancellationToken::new();
queue.incoming.register(1.into(), "textDocument/hover".to_string(), token);
// Operations on incoming don't affect outgoing
assert_eq!(queue.incoming.pending_count(), 1);
assert_eq!(queue.outgoing.pending_count(), 0);Fields§
§incoming: IncomingRequests<I>Tracker for requests received from clients.
outgoing: OutgoingRequests<O>Tracker for requests sent to clients.
Implementations§
Source§impl<I, O> RequestQueue<I, O>
impl<I, O> RequestQueue<I, O>
Trait Implementations§
Auto Trait Implementations§
impl<I, O> Freeze for RequestQueue<I, O>
impl<I, O> !RefUnwindSafe for RequestQueue<I, O>
impl<I, O> Send for RequestQueue<I, O>
impl<I, O> Sync for RequestQueue<I, O>
impl<I, O> Unpin for RequestQueue<I, O>where
I: Unpin,
impl<I, O> UnsafeUnpin for RequestQueue<I, O>
impl<I, O> !UnwindSafe for RequestQueue<I, O>
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