pub struct RequestQueue<I> {
pub incoming: IncomingRequests<I>,
pub outgoing: OutgoingRequests,
}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)
§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> = 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: OutgoingRequestsTracker for requests sent to clients.
Implementations§
Source§impl<I> RequestQueue<I>
impl<I> RequestQueue<I>
Trait Implementations§
Source§impl<I: Debug> Debug for RequestQueue<I>
impl<I: Debug> Debug for RequestQueue<I>
Auto Trait Implementations§
impl<I> Freeze for RequestQueue<I>
impl<I> !RefUnwindSafe for RequestQueue<I>
impl<I> Send for RequestQueue<I>where
I: Send,
impl<I> Sync for RequestQueue<I>where
I: Sync,
impl<I> Unpin for RequestQueue<I>where
I: Unpin,
impl<I> UnsafeUnpin for RequestQueue<I>
impl<I> !UnwindSafe for RequestQueue<I>
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