pub struct ServerRunner { /* private fields */ }
Expand description
Server runner that manages the complete lifecycle
Implementations§
Source§impl ServerRunner
impl ServerRunner
Sourcepub async fn add_listener<L>(&self, listener: L)where
L: LifecycleListener + 'static,
pub async fn add_listener<L>(&self, listener: L)where
L: LifecycleListener + 'static,
Add a lifecycle listener
Sourcepub fn lifecycle(&self) -> &LifecycleManager
pub fn lifecycle(&self) -> &LifecycleManager
Get the lifecycle manager
Sourcepub async fn start<T>(&self, transport: T) -> McpResult<()>where
T: ServerTransport + 'static,
pub async fn start<T>(&self, transport: T) -> McpResult<()>where
T: ServerTransport + 'static,
Start the server with a transport
Sourcepub async fn stop_with_timeout(
&self,
shutdown_timeout: Duration,
) -> McpResult<()>
pub async fn stop_with_timeout( &self, shutdown_timeout: Duration, ) -> McpResult<()>
Stop the server with a timeout
Sourcepub async fn run_until_shutdown<T>(&self, transport: T) -> McpResult<()>where
T: ServerTransport + 'static,
pub async fn run_until_shutdown<T>(&self, transport: T) -> McpResult<()>where
T: ServerTransport + 'static,
Run the server until shutdown signal
Sourcepub async fn run_with_signals<T>(&self, transport: T) -> McpResult<()>where
T: ServerTransport + 'static,
pub async fn run_with_signals<T>(&self, transport: T) -> McpResult<()>where
T: ServerTransport + 'static,
Run the server with graceful shutdown on CTRL+C
Sourcepub async fn is_running(&self) -> bool
pub async fn is_running(&self) -> bool
Check if the server is running
Sourcepub async fn restart<T>(&self, transport: T) -> McpResult<()>where
T: ServerTransport + 'static,
pub async fn restart<T>(&self, transport: T) -> McpResult<()>where
T: ServerTransport + 'static,
Restart the server
Sourcepub async fn wait_for_state(
&self,
target_state: LifecycleState,
timeout_duration: Option<Duration>,
) -> McpResult<()>
pub async fn wait_for_state( &self, target_state: LifecycleState, timeout_duration: Option<Duration>, ) -> McpResult<()>
Wait for the server to reach a specific state
Sourcepub async fn notify_listeners<F>(&self, f: F)
pub async fn notify_listeners<F>(&self, f: F)
Notify all listeners with a closure
Source§impl ServerRunner
impl ServerRunner
Sourcepub async fn health_status(&self) -> HealthStatus
pub async fn health_status(&self) -> HealthStatus
Get health status
Auto Trait Implementations§
impl Freeze for ServerRunner
impl !RefUnwindSafe for ServerRunner
impl Send for ServerRunner
impl Sync for ServerRunner
impl Unpin for ServerRunner
impl !UnwindSafe for ServerRunner
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