quic_rpc::client

Struct RpcClient

Source
pub struct RpcClient<S, C = BoxedConnector<S>> { /* private fields */ }
Expand description

A client for a specific service

This is a wrapper around a Connector that serves as the entry point for the client DSL.

Type parameters:

S is the service type that determines what interactions this client supports. C is the connector that determines the transport.

Implementations§

Source§

impl<S, C> RpcClient<S, C>
where S: Service, C: Connector<S>,

Source

pub fn new(source: C) -> Self

Create a new rpc client for a specific Service given a compatible Connector.

This is where a generic typed connection is converted into a client for a specific service.

You can get a client for a nested service by calling map.

Source§

impl<S, C> RpcClient<S, C>
where S: Service, C: Connector<S>,

Source

pub fn into_inner(self) -> C

Get the underlying connection

Source

pub fn map<SNext>( self, ) -> RpcClient<SNext, MappedConnector<SNext::Res, SNext::Req, C>>
where SNext: Service, S::Req: From<SNext::Req>, SNext::Res: TryFrom<S::Res>,

Map this channel’s service into an inner service.

This method is available if the required bounds are upheld: SNext::Req: Into<S::Req> + TryFrom<S::Req>, SNext::Res: Into<S::Res> + TryFrom<S::Res>,

Where SNext is the new service to map to and S is the current inner service.

This method can be chained infintely.

Source

pub fn boxed(self) -> RpcClient<S, BoxedConnector<S>>
where C: BoxableConnector<S::Res, S::Req>,

box

Source§

impl<S, C> RpcClient<S, C>
where S: Service, C: Connector<In = S::Res, Out = S::Req>,

Source

pub async fn bidi<M>( &self, msg: M, ) -> Result<(UpdateSink<C, M::Update>, BoxStreamSync<'static, Result<M::Response, ItemError<C>>>), Error<C>>
where M: BidiStreamingMsg<S>,

Bidi call to the server, request opens a stream, response is a stream

Source§

impl<S, C> RpcClient<S, C>
where S: Service, C: Connector<S>,

Source

pub async fn client_streaming<M>( &self, msg: M, ) -> Result<(UpdateSink<C, M::Update>, Boxed<Result<M::Response, ItemError<C>>>), Error<C>>
where M: ClientStreamingMsg<S>,

Call to the server that allows the client to stream, single response

Source§

impl<S, C> RpcClient<S, C>
where S: Service, C: Connector<S>,

Source

pub async fn rpc<M>(&self, msg: M) -> Result<M::Response, Error<C>>
where M: RpcMsg<S>,

RPC call to the server, single request, single response

Source§

impl<S, C> RpcClient<S, C>
where C: Connector<S>, S: Service,

Source

pub async fn server_streaming<M>( &self, msg: M, ) -> Result<BoxStreamSync<'static, Result<M::Response, ItemError<C>>>, Error<C>>
where M: ServerStreamingMsg<S>,

Bidi call to the server, request opens a stream, response is a stream

Source§

impl<S, C> RpcClient<S, C>
where C: Connector<S>, S: Service,

Source

pub async fn try_server_streaming<M>( &self, msg: M, ) -> Result<BoxStreamSync<'static, Result<M::Item, ItemError<C, M::ItemError>>>, Error<C, M::CreateError>>

Bidi call to the server, request opens a stream, response is a stream

Trait Implementations§

Source§

impl<S, C> AsRef<C> for RpcClient<S, C>
where S: Service, C: Connector<S>,

Source§

fn as_ref(&self) -> &C

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<S, C: Clone> Clone for RpcClient<S, C>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug, C: Debug> Debug for RpcClient<S, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S, C> Freeze for RpcClient<S, C>
where C: Freeze,

§

impl<S, C> RefUnwindSafe for RpcClient<S, C>

§

impl<S, C> Send for RpcClient<S, C>
where C: Send, S: Send,

§

impl<S, C> Sync for RpcClient<S, C>
where C: Sync, S: Sync,

§

impl<S, C> Unpin for RpcClient<S, C>
where C: Unpin, S: Unpin,

§

impl<S, C> UnwindSafe for RpcClient<S, C>
where C: UnwindSafe, S: UnwindSafe,

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoArcAny for T
where T: Send + Sync + 'static,

Source§

fn into_arc_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Casts Arc<Self> into Arc<dyn Any + Send + Sync>.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T