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
impl PresenceTestClient
Sourcepub fn new(client: GrpcClient, display_name: &str) -> Self
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.
Sourcepub async fn join(&mut self) -> Result<JoinResponse, String>
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.
Sourcepub async fn leave(&mut self) -> Result<(), String>
pub async fn leave(&mut self) -> Result<(), String>
Leave the presence session.
Unregisters this client from the server. Safe to call multiple times.
Sourcepub fn client_id(&self) -> u64
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.
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Get this client’s display name.
Sourcepub async fn update_cursor(
&mut self,
_line: u64,
_col: u64,
) -> Result<(), String>
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.
Sourcepub async fn follow(&mut self, target_id: u64) -> Result<(), String>
pub async fn follow(&mut self, target_id: u64) -> Result<(), String>
Set follow mode (sync mode = 1).
Sourcepub async fn independent(&mut self) -> Result<(), String>
pub async fn independent(&mut self) -> Result<(), String>
Set independent mode (sync mode = 0).
Sourcepub async fn peers(&mut self) -> Result<Vec<ClientPresence>, String>
pub async fn peers(&mut self) -> Result<Vec<ClientPresence>, String>
Get all peers (excludes self).
Sourcepub async fn all_clients(&mut self) -> Result<Vec<ClientPresence>, String>
pub async fn all_clients(&mut self) -> Result<Vec<ClientPresence>, String>
Get all clients including self.
Sourcepub fn grpc(&mut self) -> &mut GrpcClient
pub fn grpc(&mut self) -> &mut GrpcClient
Access underlying gRPC client for other operations (e.g., send_keys).
Sourcepub async fn send_keys(&mut self, keys: &str) -> Result<(), String>
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.
Sourcepub async fn get_mode(&mut self) -> Result<GetModeResponse, String>
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.
Sourcepub async fn get_cursor(&mut self) -> Result<(u64, u64), String>
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.
Sourcepub async fn get_buffer(&mut self) -> Result<String, String>
pub async fn get_buffer(&mut self) -> Result<String, String>
Get buffer content.
Returns the content of the active buffer.
Auto Trait Implementations§
impl !Freeze for PresenceTestClient
impl !RefUnwindSafe for PresenceTestClient
impl Send for PresenceTestClient
impl Sync for PresenceTestClient
impl Unpin for PresenceTestClient
impl UnsafeUnpin for PresenceTestClient
impl !UnwindSafe for PresenceTestClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request