JSONAsyncClientTransport

Struct JSONAsyncClientTransport 

Source
pub struct JSONAsyncClientTransport<C>
where C: Sink<Bytes> + Stream,
{ /* private fields */ }
Expand description

Like JSONTransport except for use as AsyncClientTransport.

Implementations§

Source§

impl<C: Sink<Bytes> + Stream> JSONAsyncClientTransport<C>

Source

pub fn new(channel: C) -> Self

Create an AsyncJSONTransport.

Source§

impl<A> JSONAsyncClientTransport<Framed<A, JSONCodec>>
where A: AsyncRead + AsyncWrite,

Source

pub fn new_unframed(channel: A) -> Self
where A: AsyncRead + AsyncWrite,

Trait Implementations§

Source§

impl<C> AsyncClientTransport for JSONAsyncClientTransport<C>
where C: Sink<Bytes, Error = Error> + Stream<Item = Result<BytesMut, Error>> + Send + Unpin,

Source§

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 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,

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,

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,

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,

Read the return value of a method call. Always called after tx_finalize. state is the object returned by tx_finalize.

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, 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, 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.