pub struct InputHandler { /* private fields */ }Expand description
输入处理器 / Input handler
Implementations§
Source§impl InputHandler
impl InputHandler
Sourcepub fn with_provider<P>(provider: P) -> Selfwhere
P: InputProvider + 'static,
pub fn with_provider<P>(provider: P) -> Selfwhere
P: InputProvider + 'static,
使用自定义提供者创建输入处理器 / Create input handler with custom provider
Sourcepub fn with_cache(self, enable: bool) -> Self
pub fn with_cache(self, enable: bool) -> Self
设置是否启用缓存 / Set whether to enable cache
Sourcepub async fn get_input(
&self,
request: InputRequest,
context: InputContext,
) -> InputResult<InputResponse>
pub async fn get_input( &self, request: InputRequest, context: InputContext, ) -> InputResult<InputResponse>
获取单个输入 / Get single input
Sourcepub async fn get_inputs(
&self,
requests: Vec<InputRequest>,
context: InputContext,
) -> InputResult<Vec<InputResponse>>
pub async fn get_inputs( &self, requests: Vec<InputRequest>, context: InputContext, ) -> InputResult<Vec<InputResponse>>
批量获取输入 / Get multiple inputs
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
清除缓存 / Clear cache
Sourcepub async fn clear_cache_for(&self, id: &str, context: &InputContext)
pub async fn clear_cache_for(&self, id: &str, context: &InputContext)
清除特定缓存 / Clear specific cache
Sourcepub async fn get_all_cached_values(&self) -> HashMap<String, InputValue>
pub async fn get_all_cached_values(&self) -> HashMap<String, InputValue>
获取所有缓存值 / Get all cached values
Sourcepub async fn set_cached_value(&self, key: String, value: InputValue)
pub async fn set_cached_value(&self, key: String, value: InputValue)
设置缓存值 / Set cached value
Sourcepub async fn remove_cached_value(&self, key: &str) -> Option<InputValue>
pub async fn remove_cached_value(&self, key: &str) -> Option<InputValue>
删除缓存值 / Remove cached value
Sourcepub async fn clear_all_cache(&self)
pub async fn clear_all_cache(&self)
清空所有缓存 / Clear all cache
Sourcepub fn create_request_from_mcp_input(
&self,
mcp_input: &MCPServerInput,
default: Option<InputValue>,
) -> InputRequest
pub fn create_request_from_mcp_input( &self, mcp_input: &MCPServerInput, default: Option<InputValue>, ) -> InputRequest
从MCP服务器输入配置创建请求 / Create request from MCP server input configuration
Sourcepub async fn handle_mcp_inputs(
&self,
inputs: &[MCPServerInput],
context: InputContext,
) -> InputResult<HashMap<String, InputValue>>
pub async fn handle_mcp_inputs( &self, inputs: &[MCPServerInput], context: InputContext, ) -> InputResult<HashMap<String, InputValue>>
处理MCP服务器输入 / Handle MCP server inputs
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InputHandler
impl !RefUnwindSafe for InputHandler
impl Send for InputHandler
impl Sync for InputHandler
impl Unpin for InputHandler
impl UnsafeUnpin for InputHandler
impl !UnwindSafe for InputHandler
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
Source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
Source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.