Skip to main content

GrpcClient

Struct GrpcClient 

Source
pub struct GrpcClient { /* private fields */ }
Expand description

gRPC v2 client for interacting with the reovim server.

Wraps all service clients (Input, State, Buffer, Server, Presence, Debug) and provides a unified interface.

§Phase #479: Client ID Management

The client auto-joins the presence session on first use and stores the assigned client_id. All subsequent calls use this ID for per-client state isolation.

Implementations§

Source§

impl GrpcClient

Source

pub async fn connect(addr: &str) -> Result<Self, GrpcClientError>

Connect to a gRPC server at the given address.

§Arguments
  • addr - Server address in host:port format (e.g., “127.0.0.1:12540”).
§Errors

Returns an error if the connection fails.

Source

pub async fn send_keys( &mut self, keys: &str, ) -> Result<SendKeysResponse, GrpcClientError>

Send keys to the editor.

§Arguments
  • keys - Keys in vim notation (e.g., iHello<Esc>).
§Returns

The response containing success status and key status.

§Errors

Returns an error if the gRPC call fails.

§Phase #479: Auto-join and panic on error

The client auto-joins the presence session on first call. Panics if joining fails or if the server returns a fatal error.

Source

pub async fn get_mode(&mut self) -> Result<GetModeResponse, GrpcClientError>

Get the current editor mode.

§Phase #479: Auto-join and per-client state

The client auto-joins on first call and queries its per-client mode.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn get_mode_for_client( &mut self, client_id: u64, ) -> Result<GetModeResponse, GrpcClientError>

Get the mode for a specific client.

§Per-client state (#471): Per-client mode isolation

Returns the mode from the specified client’s per-client mode stack.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn get_cursor(&mut self) -> Result<GetCursorResponse, GrpcClientError>

Get the cursor position.

§Phase #479: Auto-join and per-client state

The client auto-joins on first call and queries its per-client cursor.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn get_cursor_for_client( &mut self, client_id: u64, ) -> Result<GetCursorResponse, GrpcClientError>

Get the cursor position for a specific client.

§Per-client state (#471): Per-client cursor isolation

Returns the cursor from the specified client’s per-client editing state.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn list_buffers( &mut self, ) -> Result<ListBuffersResponse, GrpcClientError>

List all open buffers.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn get_buffer_content( &mut self, buffer_id: Option<u64>, ) -> Result<GetRawContentResponse, GrpcClientError>

Get raw buffer content.

§Arguments
  • buffer_id - Optional buffer ID. Uses active buffer if None.
§Errors

Returns an error if the gRPC call fails.

Source

pub async fn ping(&mut self) -> Result<PingResponse, GrpcClientError>

Ping the server (health check).

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn info(&mut self) -> Result<InfoResponse, GrpcClientError>

Get server info.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn get_registers( &mut self, names: Vec<String>, ) -> Result<GetRegistersResponse, GrpcClientError>

Get register contents.

§Arguments
  • names - Optional register names to query. If empty, returns all non-empty registers.
§Errors

Returns an error if the gRPC call fails.

Source

pub async fn get_screen_content( &mut self, client_id: u64, format: &str, ) -> Result<GetScreenContentResponse, GrpcClientError>

Get screen content via TUI capture relay.

Requests a screen capture from a specific TUI client via the server.

§Arguments
  • client_id - Target client ID to capture from
  • format - Capture format: plain_text, raw_ansi, or cell_grid
§Errors

Returns an error if the gRPC call fails, no TUI is connected, or capture times out.

Source

pub async fn presence_join( &mut self, client_type: &str, display_name: &str, ) -> Result<JoinResponse, GrpcClientError>

Join the presence session.

Registers this client with the session and receives an assigned client ID.

§Arguments
  • client_type - Client type identifier (“cli”, “tui”, “web”, “test”).
  • display_name - User-friendly display name.
§Returns

The response containing assigned client ID and list of connected peers.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn presence_leave(&mut self) -> Result<LeaveResponse, GrpcClientError>

Leave the presence session.

§Phase 5 (#483): Token identifies the client — no client_id parameter.
§Errors

Returns an error if the gRPC call fails.

Source

pub async fn presence_list( &mut self, ) -> Result<ListClientsResponse, GrpcClientError>

List all connected clients.

§Returns

The response containing all connected clients.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn presence_update( &mut self, buffer_id: Option<u64>, mode: Option<String>, ) -> Result<UpdatePresenceResponse, GrpcClientError>

Update this client’s presence state.

§Phase 5 (#483): Token identifies the client — no client_id parameter.
§Errors

Returns an error if the gRPC call fails.

Source

pub async fn presence_set_sync_mode( &mut self, sync_mode: i32, follow_target: Option<u64>, ) -> Result<SetSyncModeResponse, GrpcClientError>

Set sync mode for this client.

§Phase 5 (#483): Token identifies the client — no client_id parameter.
§Errors

Returns an error if the gRPC call fails.

Source

pub async fn log_tail( &mut self, count: u32, level: Option<String>, target: Option<String>, grep: Option<String>, ) -> Result<LogTailResponse, GrpcClientError>

Get recent log entries from the server ring buffer.

§Arguments
  • count - Number of entries to retrieve (default: 50).
  • level - Optional level filter (trace, debug, info, warn, error).
  • target - Optional target module filter (contains match).
  • grep - Optional message filter (case-insensitive contains).
§Returns

The response containing log entries.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn debug_send_keys( &mut self, keys: &str, target_client_id: u64, ) -> Result<DebugSendKeysResponse, GrpcClientError>

Send keys to a specific client’s state via DebugService.

No auth required — CLI targets the client by ID directly.

§Errors

Returns an error if the gRPC call fails or target client doesn’t exist.

Source

pub async fn debug_capture( &mut self, target_client_id: u64, format: &str, ) -> Result<DebugCaptureResponse, GrpcClientError>

Capture a specific client’s screen content via DebugService.

No auth required — CLI targets the client by ID directly.

§Errors

Returns an error if the gRPC call fails, client doesn’t exist, or capture times out.

Source

pub async fn debug_get_mode( &mut self, target_client_id: u64, ) -> Result<DebugGetModeResponse, GrpcClientError>

Get a specific client’s current editor mode via DebugService.

No auth required — CLI targets the client by ID directly.

§Errors

Returns an error if the gRPC call fails or target client doesn’t exist.

Source

pub async fn debug_get_cursor( &mut self, target_client_id: u64, ) -> Result<DebugGetCursorResponse, GrpcClientError>

Get a specific client’s cursor position via DebugService.

No auth required — CLI targets the client by ID directly.

§Errors

Returns an error if the gRPC call fails or target client doesn’t exist.

Source

pub async fn debug_list_clients( &mut self, ) -> Result<DebugListClientsResponse, GrpcClientError>

List connected clients via DebugService.

No auth required — read-only debug query.

§Errors

Returns an error if the gRPC call fails.

Source

pub async fn debug_get_extension_state( &mut self, kind: &str, target_client_id: u64, ) -> Result<DebugGetExtensionStateResponse, GrpcClientError>

Query extension state for a specific client via DebugService.

No auth required — CLI targets the client by ID directly.

§Errors

Returns an error if the gRPC call fails or extension kind is unknown.

Source

pub async fn debug_list_extensions( &mut self, ) -> Result<DebugListExtensionsResponse, GrpcClientError>

List all registered extensions via DebugService.

No auth required — read-only debug query.

§Errors

Returns an error if the gRPC call fails.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more