pub trait FromContextPart<C>: Sized {
// Required method
fn from_context_part(context: &mut C) -> Result<Self, ErrorData>;
}Available on crate features
mcp and server and tools only.Expand description
Trait for extracting parts from a context, unifying tool and prompt extraction
Required Methods§
fn from_context_part(context: &mut C) -> Result<Self, ErrorData>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<C> FromContextPart<C> for CancellationTokenwhere
C: AsRequestContext,
impl<C> FromContextPart<C> for CancellationTokenwhere
C: AsRequestContext,
fn from_context_part(context: &mut C) -> Result<CancellationToken, ErrorData>
Source§impl<S> FromContextPart<ToolCallContext<'_, S>> for Map<String, Value>
impl<S> FromContextPart<ToolCallContext<'_, S>> for Map<String, Value>
fn from_context_part( context: &mut ToolCallContext<'_, S>, ) -> Result<Map<String, Value>, ErrorData>
Implementors§
impl<C, T> FromContextPart<C> for Extension<T>
impl<C> FromContextPart<C> for Extensionswhere
C: AsRequestContext,
impl<C> FromContextPart<C> for Peer<RoleServer>where
C: AsRequestContext,
impl<C> FromContextPart<C> for RequestContext<RoleServer>where
C: AsRequestContext,
Common extractors that can be used by both tool and prompt handlers