pub struct LifecycleManager { /* private fields */ }
Expand description
Lifecycle manager for server state transitions
Implementations§
Source§impl LifecycleManager
impl LifecycleManager
pub fn new() -> Self
pub fn get_state(&self) -> &ServerState
pub async fn transition_to(&mut self, new_state: ServerState)
pub async fn start(&mut self) -> Result<(), McpError>
pub async fn stop(&mut self) -> Result<(), McpError>
pub fn on_start( &mut self, callback: Box<dyn Fn() -> Result<(), McpError> + Send + Sync>, )
pub fn on_stop( &mut self, callback: Box<dyn Fn() -> Result<(), McpError> + Send + Sync>, )
pub fn get_listener_count(&self, event: &str) -> usize
pub fn add_pre_start_hook( &mut self, hook: Box<dyn Fn() -> Result<(), McpError> + Send + Sync>, )
pub fn add_post_start_hook( &mut self, hook: Box<dyn Fn() -> Result<(), McpError> + Send + Sync>, )
pub fn add_pre_stop_hook( &mut self, hook: Box<dyn Fn() -> Result<(), McpError> + Send + Sync>, )
pub fn add_post_stop_hook( &mut self, hook: Box<dyn Fn() -> Result<(), McpError> + Send + Sync>, )
pub fn get_hook_count(&self, hook_type: &str) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LifecycleManager
impl !RefUnwindSafe for LifecycleManager
impl Send for LifecycleManager
impl Sync for LifecycleManager
impl Unpin for LifecycleManager
impl !UnwindSafe for LifecycleManager
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