Skip to main content

PresenceTestClient

Struct PresenceTestClient 

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

Presence-aware test client wrapper.

Provides convenient methods for presence operations during E2E testing. Each client maintains its own gRPC connection and client ID.

Implementations§

Source§

impl PresenceTestClient

Source

pub fn new(client: GrpcClient, display_name: &str) -> Self

Create a new presence test client (not yet joined).

Call join() to register with the presence service.

Source

pub async fn join(&mut self) -> Result<JoinResponse, String>

Join the presence session.

Registers this client with the server and receives an assigned client ID. Returns the full join response including peer list.

Source

pub async fn leave(&mut self) -> Result<(), String>

Leave the presence session.

Unregisters this client from the server. Safe to call multiple times.

Source

pub fn client_id(&self) -> u64

Get client ID (panics if not joined).

§Panics

Panics if join() has not been called or if the client has left.

Source

pub const fn is_joined(&self) -> bool

Check if this client has joined.

Source

pub fn display_name(&self) -> &str

Get this client’s display name.

Source

pub async fn update_cursor( &mut self, _line: u64, _col: u64, ) -> Result<(), String>

Update cursor position.

Note: This is now a no-op (Phase 14, #471). Cursor tracking moved to CursorMoved notifications with client_id. This method is preserved for test compatibility but does nothing.

Source

pub async fn update_buffer(&mut self, buffer_id: u64) -> Result<(), String>

Update buffer ID.

Source

pub async fn update_mode(&mut self, mode: &str) -> Result<(), String>

Update mode.

Source

pub async fn follow(&mut self, target_id: u64) -> Result<(), String>

Set follow mode (sync mode = 1).

Source

pub async fn present(&mut self) -> Result<(), String>

Set present mode (sync mode = 2).

Source

pub async fn independent(&mut self) -> Result<(), String>

Set independent mode (sync mode = 0).

Source

pub async fn peers(&mut self) -> Result<Vec<ClientPresence>, String>

Get all peers (excludes self).

Source

pub async fn all_clients(&mut self) -> Result<Vec<ClientPresence>, String>

Get all clients including self.

Source

pub fn grpc(&mut self) -> &mut GrpcClient

Access underlying gRPC client for other operations (e.g., send_keys).

Source

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

Send keys using this client’s ID for per-client mode routing.

§Per-client state (#471): Per-client input routing

Keys are processed using this client’s per-client mode stack, enabling multi-client mode isolation.

Source

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

Get the current mode for this client.

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

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

Source

pub async fn get_cursor(&mut self) -> Result<(u64, u64), String>

Get cursor position for this client.

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

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

Source

pub async fn get_buffer(&mut self) -> Result<String, String>

Get buffer content.

Returns the content of the active buffer.

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