pub struct JSONAsyncClientTransport<C>{ /* private fields */ }Expand description
Like JSONTransport except for use as AsyncClientTransport.
Implementations§
Source§impl<A> JSONAsyncClientTransport<Framed<A, JSONCodec>>where
A: AsyncRead + AsyncWrite,
impl<A> JSONAsyncClientTransport<Framed<A, JSONCodec>>where
A: AsyncRead + AsyncWrite,
pub fn new_unframed(channel: A) -> Selfwhere
A: AsyncRead + AsyncWrite,
Trait Implementations§
Source§impl<C> AsyncClientTransport for JSONAsyncClientTransport<C>
impl<C> AsyncClientTransport for JSONAsyncClientTransport<C>
Source§type TXState = JTXState
type TXState = JTXState
Type of transport-internal state used when bulding a call for
transmission on the client. May be unit if the transport does not need to track
state or does so through member variables.
Source§type FinalState = ()
type FinalState = ()
Type of state object returned from tx_finalize and consumed by rx_response. May be unit.
Source§fn tx_begin_call<'life0, 'async_trait>(
&'life0 mut self,
method: MethodId,
) -> Pin<Box<dyn Future<Output = Result<JTXState, RPCError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tx_begin_call<'life0, 'async_trait>(
&'life0 mut self,
method: MethodId,
) -> Pin<Box<dyn Future<Output = Result<JTXState, RPCError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Begin calling the given method. The transport may begin transmitting over the wire,
or it may may wait until the call to
tx_finalize.Source§fn tx_add_param<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'static str,
value: impl Serialize + Send + 'async_trait,
state: &'life1 mut JTXState,
) -> Pin<Box<dyn Future<Output = Result<(), RPCError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn tx_add_param<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'static str,
value: impl Serialize + Send + 'async_trait,
state: &'life1 mut JTXState,
) -> Pin<Box<dyn Future<Output = Result<(), RPCError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add a parameter to a method call started with
tx_begin_call. This method is guaranteed to be called only
after tx_begin_call and to be called appropriately for each
parameter of the method passed to tx_begin_call. state is
the object returned by tx_begin_call. Parameters are always
added and read in order, so transmitting the name is not a requirement.Source§fn tx_finalize<'life0, 'async_trait>(
&'life0 mut self,
state: JTXState,
) -> Pin<Box<dyn Future<Output = Result<(), RPCError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tx_finalize<'life0, 'async_trait>(
&'life0 mut self,
state: JTXState,
) -> Pin<Box<dyn Future<Output = Result<(), RPCError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Finalize transmission of a method call. Called only after
tx_begin_call and appropriate calls to tx_add_param. If
the transport has not yet transmitted the method identifier
and parameters over the wire, it should do so at this time.Source§fn rx_response<'life0, 'async_trait, T>(
&'life0 mut self,
_state: (),
) -> Pin<Box<dyn Future<Output = Result<T, RPCError>> + Send + 'async_trait>>where
for<'de> T: Deserialize<'de> + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn rx_response<'life0, 'async_trait, T>(
&'life0 mut self,
_state: (),
) -> Pin<Box<dyn Future<Output = Result<T, RPCError>> + Send + 'async_trait>>where
for<'de> T: Deserialize<'de> + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Read the return value of a method call. Always called after
tx_finalize. state is the object returned by
tx_finalize.Auto Trait Implementations§
impl<C> Freeze for JSONAsyncClientTransport<C>where
C: Freeze,
impl<C> RefUnwindSafe for JSONAsyncClientTransport<C>where
C: RefUnwindSafe,
impl<C> Send for JSONAsyncClientTransport<C>where
C: Send,
impl<C> Sync for JSONAsyncClientTransport<C>where
C: Sync,
impl<C> Unpin for JSONAsyncClientTransport<C>where
C: Unpin,
impl<C> UnwindSafe for JSONAsyncClientTransport<C>where
C: 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