#[non_exhaustive]pub struct RequestContext<R: ServiceRole> {
pub ct: CancellationToken,
pub id: RequestId,
pub meta: RequestMetaObject,
pub extensions: Extensions,
pub peer: Peer<R>,
}Available on crate features
client or server only.Expand description
Request execution context
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ct: CancellationTokenthis token will be cancelled when the CancelledNotification is received.
id: RequestId§meta: RequestMetaObject§extensions: Extensions§peer: Peer<R>An interface to fetch the remote client or server
Implementations§
Source§impl<R: ServiceRole> RequestContext<R>
impl<R: ServiceRole> RequestContext<R>
Source§impl RequestContext<RoleServer>
impl RequestContext<RoleServer>
Sourcepub fn protocol_version(&self) -> Option<ProtocolVersion>
Available on crate feature server only.
pub fn protocol_version(&self) -> Option<ProtocolVersion>
server only.The current request’s protocol version, falling back to legacy handshake state.
Sourcepub fn client_info(&self) -> Option<Implementation>
Available on crate feature server only.
pub fn client_info(&self) -> Option<Implementation>
server only.The current request’s client implementation, falling back only for legacy sessions.
Sourcepub fn client_capabilities(&self) -> Option<ClientCapabilities>
Available on crate feature server only.
pub fn client_capabilities(&self) -> Option<ClientCapabilities>
server only.The current request’s client capabilities, falling back only for legacy sessions.
Trait Implementations§
Source§impl<R: Clone + ServiceRole> Clone for RequestContext<R>
impl<R: Clone + ServiceRole> Clone for RequestContext<R>
Source§fn clone(&self) -> RequestContext<R>
fn clone(&self) -> RequestContext<R>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<R: Debug + ServiceRole> Debug for RequestContext<R>
impl<R: Debug + ServiceRole> Debug for RequestContext<R>
Source§impl<C> FromContextPart<C> for RequestContext<RoleServer>where
C: AsRequestContext,
Available on crate feature server only.Common extractors that can be used by both tool and prompt handlers
impl<C> FromContextPart<C> for RequestContext<RoleServer>where
C: AsRequestContext,
Available on crate feature
server only.Common extractors that can be used by both tool and prompt handlers
Auto Trait Implementations§
impl<R> !RefUnwindSafe for RequestContext<R>
impl<R> !UnwindSafe for RequestContext<R>
impl<R> Freeze for RequestContext<R>
impl<R> Send for RequestContext<R>
impl<R> Sync for RequestContext<R>
impl<R> Unpin for RequestContext<R>
impl<R> UnsafeUnpin for RequestContext<R>where
Peer<R>: UnsafeUnpin,
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