pub trait ReplClientAdapter: Send {
// Required methods
fn send_eval<'life0, 'async_trait>(
&'life0 mut self,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn recv_response<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn current_session(&self) -> &SessionId;
// Provided methods
fn handle_special_command<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_input: &'life1 str,
_color_enabled: bool,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn record_usage(&mut self, _command_type: CommandType) { ... }
fn create_session<'life0, 'async_trait>(
&'life0 mut self,
_name: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SessionId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn switch_session<'life0, 'async_trait>(
&'life0 mut self,
_session_id: SessionId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn close_session<'life0, 'async_trait>(
&'life0 mut self,
_session_id: Option<SessionId>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait for REPL client adapters
Abstracts the transport layer for different REPL client modes:
InProcessAdapter: Channel-based for interactive modeTcpAdapter: TCP transport for connect mode
Required Methods§
Sourcefn send_eval<'life0, 'async_trait>(
&'life0 mut self,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_eval<'life0, 'async_trait>(
&'life0 mut self,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send an eval request to the server
Sourcefn recv_response<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recv_response<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive a response from the server
Sourcefn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the client connection
Sourcefn current_session(&self) -> &SessionId
fn current_session(&self) -> &SessionId
Get current session ID
Returns the currently active session ID.
Provided Methods§
Sourcefn handle_special_command<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_input: &'life1 str,
_color_enabled: bool,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_special_command<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_input: &'life1 str,
_color_enabled: bool,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle special commands (e.g., stats in interactive mode)
Returns Some(output) if the command was handled, None to continue normal eval.
Default implementation returns None (no special handling).
Made async to support protocol-level stats requests in remote mode.
Sourcefn record_usage(&mut self, _command_type: CommandType)
fn record_usage(&mut self, _command_type: CommandType)
Record a usage metric for the given command type
Default implementation does nothing (no-op). Interactive mode will override this to track command frequency.
Sourcefn create_session<'life0, 'async_trait>(
&'life0 mut self,
_name: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SessionId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_session<'life0, 'async_trait>(
&'life0 mut self,
_name: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SessionId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new session
Returns the new session ID on success. Default implementation returns an error.
Sourcefn switch_session<'life0, 'async_trait>(
&'life0 mut self,
_session_id: SessionId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn switch_session<'life0, 'async_trait>(
&'life0 mut self,
_session_id: SessionId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Switch to a different session
Returns Ok if the session exists and switch was successful. Default implementation returns an error.
Sourcefn close_session<'life0, 'async_trait>(
&'life0 mut self,
_session_id: Option<SessionId>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close_session<'life0, 'async_trait>(
&'life0 mut self,
_session_id: Option<SessionId>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close a session
Closes the specified session. If None, closes current session. Default implementation returns an error.