pub struct RpcClient<S: Service, C: ChannelTypes> { /* private fields */ }
Expand description
A client for a specific service
This is a wrapper around a crate::ClientChannel that serves as the entry point for the client DSL.
S
is the service type, C
is the channel type.
Implementations§
source§impl<S: Service, C: ChannelTypes> RpcClient<S, C>
impl<S: Service, C: ChannelTypes> RpcClient<S, C>
sourcepub fn new(channel: C::ClientChannel<S::Res, S::Req>) -> Self
pub fn new(channel: C::ClientChannel<S::Res, S::Req>) -> Self
Create a new rpc client from a channel
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