pub struct RemoteClient { /* private fields */ }Expand description
A connected JSON-RPC client.
Implementations§
Source§impl RemoteClient
impl RemoteClient
Sourcepub async fn connect(addr: &str) -> Result<Self, String>
pub async fn connect(addr: &str) -> Result<Self, String>
Connect to addr (e.g. 127.0.0.1:9899).
Sourcepub async fn authenticate(&mut self, token: &str) -> Result<(), String>
pub async fn authenticate(&mut self, token: &str) -> Result<(), String>
Authenticate the connection. Required when the server was started with a
token; a no-op when token is empty (server auth disabled).
Sourcepub async fn call(
&mut self,
method: &str,
params: Value,
) -> Result<Value, String>
pub async fn call( &mut self, method: &str, params: Value, ) -> Result<Value, String>
Send a request and await its matching response (used for the handshake, before the event stream starts). Non-matching lines are ignored.
Sourcepub fn start_event_pump(
&mut self,
subscription_id: u64,
) -> UnboundedReceiver<Value>
pub fn start_event_pump( &mut self, subscription_id: u64, ) -> UnboundedReceiver<Value>
Consume the read half into a background task that forwards every
method == "event" payload for subscription_id to the returned
receiver. The task ends (and the channel closes) when the socket closes.
Sourcepub async fn send_command(
&mut self,
session_id: &str,
command: Value,
) -> Result<(), String>
pub async fn send_command( &mut self, session_id: &str, command: Value, ) -> Result<(), String>
Forward a raw --mode rpc command object to the session.
Sourcepub async fn stop_session(&mut self, session_id: &str)
pub async fn stop_session(&mut self, session_id: &str)
Best-effort session teardown.
Auto Trait Implementations§
impl Freeze for RemoteClient
impl RefUnwindSafe for RemoteClient
impl Send for RemoteClient
impl Sync for RemoteClient
impl Unpin for RemoteClient
impl UnsafeUnpin for RemoteClient
impl UnwindSafe for RemoteClient
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more