pub struct RequestSender { /* private fields */ }Expand description
Sends server-to-client requests through the transport.
This struct provides a way to send requests to the client and await responses.
It works in conjunction with PendingRequests to track in-flight requests.
Implementations§
Source§impl RequestSender
impl RequestSender
Sourcepub fn new(pending: Arc<PendingRequests>, send_fn: TransportSendFn) -> Self
pub fn new(pending: Arc<PendingRequests>, send_fn: TransportSendFn) -> Self
Creates a new request sender.
Sourcepub fn send_request<T: DeserializeOwned>(
&self,
cx: &Cx,
method: &str,
params: Value,
) -> McpResult<T>
pub fn send_request<T: DeserializeOwned>( &self, cx: &Cx, method: &str, params: Value, ) -> McpResult<T>
Sends a request to the client and waits for a response.
§Errors
Returns an error if:
- The transport send fails
- The request times out (based on budget)
- The client returns an error response
- The connection is closed
Trait Implementations§
Source§impl Clone for RequestSender
impl Clone for RequestSender
Source§fn clone(&self) -> RequestSender
fn clone(&self) -> RequestSender
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RequestSender
impl !RefUnwindSafe for RequestSender
impl Send for RequestSender
impl Sync for RequestSender
impl Unpin for RequestSender
impl !UnwindSafe for RequestSender
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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).