pub struct RpcClient<S: Service, C: ChannelTypes> { /* private fields */ }Expand description
A client for a specific service
This is a wrapper around a crate::Channel that serves as the entry point for the client DSL.
S is the service type, C is the channel type.
Implementations
sourceimpl<S: Service, C: ChannelTypes> RpcClient<S, C>
impl<S: Service, C: ChannelTypes> RpcClient<S, C>
sourcepub fn new(channel: C::Channel<S::Res, S::Req>) -> Self
pub fn new(channel: C::Channel<S::Res, S::Req>) -> Self
Create a new client channel from a channel and a service type
sourcepub async fn rpc<M>(&self, msg: M) -> Result<M::Response, RpcClientError<C>>where
M: Msg<S, Pattern = Rpc> + Into<S::Req>,
pub async fn rpc<M>(&self, msg: M) -> Result<M::Response, RpcClientError<C>>where
M: Msg<S, Pattern = Rpc> + Into<S::Req>,
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: Msg<S, Pattern = ServerStreaming> + Into<S::Req>,
pub async fn server_streaming<M>(
&self,
msg: M
) -> Result<BoxStream<'static, Result<M::Response, StreamingResponseItemError<C>>>, StreamingResponseError<C>>where
M: Msg<S, Pattern = ServerStreaming> + Into<S::Req>,
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>, BoxFuture<'static, Result<M::Response, ClientStreamingItemError<C>>>), ClientStreamingError<C>>where
M: Msg<S, Pattern = ClientStreaming> + Into<S::Req>,
pub async fn client_streaming<M>(
&self,
msg: M
) -> Result<(UpdateSink<S, C, M>, BoxFuture<'static, Result<M::Response, ClientStreamingItemError<C>>>), ClientStreamingError<C>>where
M: Msg<S, Pattern = ClientStreaming> + Into<S::Req>,
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>, BoxStream<'static, Result<M::Response, BidiItemError<C>>>), BidiError<C>>where
M: Msg<S, Pattern = BidiStreaming> + Into<S::Req>,
pub async fn bidi<M>(
&self,
msg: M
) -> Result<(UpdateSink<S, C, M>, BoxStream<'static, Result<M::Response, BidiItemError<C>>>), BidiError<C>>where
M: Msg<S, Pattern = BidiStreaming> + Into<S::Req>,
Bidi call to the server, request opens a stream, response is a stream
Trait Implementations
sourceimpl<S: Service, C: ChannelTypes> Clone for RpcClient<S, C>
impl<S: Service, C: ChannelTypes> Clone for RpcClient<S, C>
Auto Trait Implementations
impl<S, C> RefUnwindSafe for RpcClient<S, C>where
S: RefUnwindSafe,
<C as ChannelTypes>::Channel<<S as Service>::Res, <S as Service>::Req>: 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>where
S: Unpin,
<C as ChannelTypes>::Channel<<S as Service>::Res, <S as Service>::Req>: Unpin,
impl<S, C> UnwindSafe for RpcClient<S, C>where
S: UnwindSafe,
<C as ChannelTypes>::Channel<<S as Service>::Res, <S as Service>::Req>: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more