pub struct TransportWireClient<T: Transport> { /* private fields */ }Expand description
A WireClient implementation backed by any Transport.
Implementations§
Source§impl<T: Transport> TransportWireClient<T>
impl<T: Transport> TransportWireClient<T>
Sourcepub fn into_transport(self) -> T
pub fn into_transport(self) -> T
Consume the client and return the underlying transport.
Sourcepub fn with_default_timeout(self, timeout: Duration) -> Self
pub fn with_default_timeout(self, timeout: Duration) -> Self
Set a default timeout applied to every read_response call.
Without this, read_response waits indefinitely for a matching id.
Trait Implementations§
Source§impl<T: Transport> WireClient for TransportWireClient<T>
impl<T: Transport> WireClient for TransportWireClient<T>
Source§async fn send_request<Params: Serialize + Sync>(
&mut self,
req: &JsonRpcRequest<Params>,
) -> Result<(), WireError>
async fn send_request<Params: Serialize + Sync>( &mut self, req: &JsonRpcRequest<Params>, ) -> Result<(), WireError>
Send a JSON-RPC request.
Source§async fn read_raw_message(&mut self) -> Result<RawWireMessage, WireError>
async fn read_raw_message(&mut self) -> Result<RawWireMessage, WireError>
Read the next incoming raw wire message.
Source§async fn read_raw_message_timeout(
&mut self,
timeout: Duration,
) -> Result<RawWireMessage, WireError>
async fn read_raw_message_timeout( &mut self, timeout: Duration, ) -> Result<RawWireMessage, WireError>
Read the next incoming raw wire message with a timeout.
Source§async fn read_response<Res: DeserializeOwned + Send>(
&mut self,
expected_id: &str,
) -> Result<Res, WireError>
async fn read_response<Res: DeserializeOwned + Send>( &mut self, expected_id: &str, ) -> Result<Res, WireError>
Wait for a response matching
expected_id, buffering out-of-order
messages internally.Source§async fn send_response<Res: Serialize + Send>(
&mut self,
id: &str,
result: Res,
) -> Result<(), WireError>
async fn send_response<Res: Serialize + Send>( &mut self, id: &str, result: Res, ) -> Result<(), WireError>
Send a JSON-RPC success response.
Source§async fn send_error(
&mut self,
id: &str,
code: i32,
message: &str,
) -> Result<(), WireError>
async fn send_error( &mut self, id: &str, code: i32, message: &str, ) -> Result<(), WireError>
Send a JSON-RPC error response.
Source§async fn initialize(
&mut self,
params: InitializeParams,
) -> Result<InitializeResult, WireError>
async fn initialize( &mut self, params: InitializeParams, ) -> Result<InitializeResult, WireError>
Perform the initialize handshake.
Source§fn is_handshake_done(&self) -> bool
fn is_handshake_done(&self) -> bool
Returns true if the initialize handshake has completed.
Source§fn prompt(
&mut self,
user_input: impl Into<UserInput> + Send,
) -> impl Future<Output = Result<PromptResult, WireError>> + Send
fn prompt( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<PromptResult, WireError>> + Send
Send a prompt and wait for the result.
Source§fn start_prompt(
&mut self,
user_input: impl Into<UserInput> + Send,
) -> impl Future<Output = Result<String, WireError>> + Send
fn start_prompt( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<String, WireError>> + Send
Send a prompt without waiting for the result.
Source§fn replay(
&mut self,
) -> impl Future<Output = Result<ReplayResult, WireError>> + Send
fn replay( &mut self, ) -> impl Future<Output = Result<ReplayResult, WireError>> + Send
Replay events and requests from the current session.
Source§fn steer(
&mut self,
user_input: impl Into<UserInput> + Send,
) -> impl Future<Output = Result<SteerResult, WireError>> + Send
fn steer( &mut self, user_input: impl Into<UserInput> + Send, ) -> impl Future<Output = Result<SteerResult, WireError>> + Send
Steer the current turn with additional user input.
Source§fn set_plan_mode(
&mut self,
enabled: bool,
) -> impl Future<Output = Result<SetPlanModeResult, WireError>> + Send
fn set_plan_mode( &mut self, enabled: bool, ) -> impl Future<Output = Result<SetPlanModeResult, WireError>> + Send
Enable or disable plan mode.
Auto Trait Implementations§
impl<T> Freeze for TransportWireClient<T>where
T: Freeze,
impl<T> RefUnwindSafe for TransportWireClient<T>where
T: RefUnwindSafe,
impl<T> Send for TransportWireClient<T>
impl<T> Sync for TransportWireClient<T>where
T: Sync,
impl<T> Unpin for TransportWireClient<T>where
T: Unpin,
impl<T> UnsafeUnpin for TransportWireClient<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TransportWireClient<T>where
T: UnwindSafe,
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