pub struct HandlerRegistry {
pub elicitation: Option<Arc<dyn ElicitationHandler>>,
pub progress: Option<Arc<dyn ProgressHandler>>,
pub log: Option<Arc<dyn LogHandler>>,
pub resource_update: Option<Arc<dyn ResourceUpdateHandler>>,
}
Expand description
Registry for managing client-side handlers
This registry holds all the handler implementations and provides methods for registering and invoking them. It’s used internally by the Client to dispatch server-initiated requests to the appropriate handlers.
Fields§
§elicitation: Option<Arc<dyn ElicitationHandler>>
Elicitation handler for user input requests
progress: Option<Arc<dyn ProgressHandler>>
Progress handler for operation updates
log: Option<Arc<dyn LogHandler>>
Log handler for server log messages
resource_update: Option<Arc<dyn ResourceUpdateHandler>>
Resource update handler for resource change notifications
Implementations§
Source§impl HandlerRegistry
impl HandlerRegistry
Sourcepub fn set_elicitation_handler(&mut self, handler: Arc<dyn ElicitationHandler>)
pub fn set_elicitation_handler(&mut self, handler: Arc<dyn ElicitationHandler>)
Register an elicitation handler
Sourcepub fn set_progress_handler(&mut self, handler: Arc<dyn ProgressHandler>)
pub fn set_progress_handler(&mut self, handler: Arc<dyn ProgressHandler>)
Register a progress handler
Sourcepub fn set_log_handler(&mut self, handler: Arc<dyn LogHandler>)
pub fn set_log_handler(&mut self, handler: Arc<dyn LogHandler>)
Register a log handler
Sourcepub fn set_resource_update_handler(
&mut self,
handler: Arc<dyn ResourceUpdateHandler>,
)
pub fn set_resource_update_handler( &mut self, handler: Arc<dyn ResourceUpdateHandler>, )
Register a resource update handler
Sourcepub fn has_elicitation_handler(&self) -> bool
pub fn has_elicitation_handler(&self) -> bool
Check if an elicitation handler is registered
Sourcepub fn has_progress_handler(&self) -> bool
pub fn has_progress_handler(&self) -> bool
Check if a progress handler is registered
Sourcepub fn has_log_handler(&self) -> bool
pub fn has_log_handler(&self) -> bool
Check if a log handler is registered
Sourcepub fn has_resource_update_handler(&self) -> bool
pub fn has_resource_update_handler(&self) -> bool
Check if a resource update handler is registered
Sourcepub async fn handle_elicitation(
&self,
request: ElicitationRequest,
) -> HandlerResult<ElicitationResponse>
pub async fn handle_elicitation( &self, request: ElicitationRequest, ) -> HandlerResult<ElicitationResponse>
Handle an elicitation request
Sourcepub async fn handle_progress(
&self,
notification: ProgressNotification,
) -> HandlerResult<()>
pub async fn handle_progress( &self, notification: ProgressNotification, ) -> HandlerResult<()>
Handle a progress notification
Sourcepub async fn handle_log(&self, log: LogMessage) -> HandlerResult<()>
pub async fn handle_log(&self, log: LogMessage) -> HandlerResult<()>
Handle a log message
Sourcepub async fn handle_resource_update(
&self,
notification: ResourceUpdateNotification,
) -> HandlerResult<()>
pub async fn handle_resource_update( &self, notification: ResourceUpdateNotification, ) -> HandlerResult<()>
Handle a resource update notification