pub trait Transport: Send + Sync {
// Required methods
fn send_message<'life0, 'async_trait>(
&'life0 mut self,
message: JsonRpcMessage,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn receive_message<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcMessage, TransportError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided methods
fn get_state(&self) -> ConnectionState { ... }
fn get_health(&self) -> TransportHealth { ... }
fn is_ready(&self) -> bool { ... }
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
config: ShutdownConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn force_shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn reconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn reset<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Enhanced transport trait with lifecycle management
Required Methods§
Sourcefn send_message<'life0, 'async_trait>(
&'life0 mut self,
message: JsonRpcMessage,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn send_message<'life0, 'async_trait>(
&'life0 mut self,
message: JsonRpcMessage,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Send a message through the transport
Sourcefn receive_message<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcMessage, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn receive_message<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcMessage, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Receive a message from the transport
Provided Methods§
Sourcefn get_state(&self) -> ConnectionState
fn get_state(&self) -> ConnectionState
Get current connection state
Sourcefn get_health(&self) -> TransportHealth
fn get_health(&self) -> TransportHealth
Get transport health information
Sourcefn shutdown<'life0, 'async_trait>(
&'life0 mut self,
config: ShutdownConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
config: ShutdownConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Initiate graceful shutdown
Sourcefn force_shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn force_shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Force immediate shutdown