ReplClientAdapter

Trait ReplClientAdapter 

Source
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 mode
  • TcpAdapter: TCP transport for connect mode

Required Methods§

Source

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

Source

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

Source

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

Source

fn current_session(&self) -> &SessionId

Get current session ID

Returns the currently active session ID.

Provided Methods§

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Implementors§