pub struct RpcClient<S, C> { /* private fields */ }Expand description
A client for a specific service
This is a wrapper around a ServiceConnection that serves as the entry point
for the client DSL. S is the service type, C is the substream source.
Implementations§
source§impl<S: Service, C: ServiceConnection<S>> RpcClient<S, C>
impl<S: Service, C: ServiceConnection<S>> RpcClient<S, C>
sourcepub fn new(source: C) -> Self
pub fn new(source: C) -> Self
Create a new rpc client for a specific Service given a compatible ServiceConnection.
This is where a generic typed connection is converted into a client for a specific service.
sourcepub fn into_inner(self) -> C
pub fn into_inner(self) -> C
Get the underlying connection
sourcepub async fn rpc<M>(&self, msg: M) -> Result<M::Response, RpcClientError<C>>where
M: RpcMsg<S>,
pub async fn rpc<M>(&self, msg: M) -> Result<M::Response, RpcClientError<C>>where
M: RpcMsg<S>,
RPC call to the server, single request, single response
sourcepub async fn server_streaming<M>(
&self,
msg: M
) -> Result<BoxStream<'static, Result<M::Response, StreamingResponseItemError<C>>>, StreamingResponseError<C>>where
M: ServerStreamingMsg<S>,
pub async fn server_streaming<M>(
&self,
msg: M
) -> Result<BoxStream<'static, Result<M::Response, StreamingResponseItemError<C>>>, StreamingResponseError<C>>where
M: ServerStreamingMsg<S>,
Bidi call to the server, request opens a stream, response is a stream
sourcepub async fn client_streaming<M>(
&self,
msg: M
) -> Result<(UpdateSink<S, C, M::Update>, BoxFuture<'static, Result<M::Response, ClientStreamingItemError<C>>>), ClientStreamingError<C>>where
M: ClientStreamingMsg<S>,
pub async fn client_streaming<M>(
&self,
msg: M
) -> Result<(UpdateSink<S, C, M::Update>, BoxFuture<'static, Result<M::Response, ClientStreamingItemError<C>>>), ClientStreamingError<C>>where
M: ClientStreamingMsg<S>,
Call to the server that allows the client to stream, single response
sourcepub async fn bidi<M>(
&self,
msg: M
) -> Result<(UpdateSink<S, C, M::Update>, BoxStream<'static, Result<M::Response, BidiItemError<C>>>), BidiError<C>>where
M: BidiStreamingMsg<S>,
pub async fn bidi<M>(
&self,
msg: M
) -> Result<(UpdateSink<S, C, M::Update>, BoxStream<'static, Result<M::Response, BidiItemError<C>>>), BidiError<C>>where
M: BidiStreamingMsg<S>,
Bidi call to the server, request opens a stream, response is a stream
Trait Implementations§
Auto Trait Implementations§
impl<S, C> RefUnwindSafe for RpcClient<S, C>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, C> Send for RpcClient<S, C>
impl<S, C> Sync for RpcClient<S, C>
impl<S, C> Unpin for RpcClient<S, C>
impl<S, C> UnwindSafe for RpcClient<S, C>where
C: UnwindSafe,
S: 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