pub struct RpcClient<S, C, SInner = S> { /* 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, C> RpcClient<S, C, S>where
S: Service,
C: ServiceConnection<S>,
impl<S, C> RpcClient<S, C, S>where
S: Service,
C: ServiceConnection<S>,
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.
source§impl<S, C, SInner> RpcClient<S, C, SInner>
impl<S, C, SInner> RpcClient<S, C, SInner>
sourcepub fn into_inner(self) -> C
pub fn into_inner(self) -> C
Get the underlying connection
sourcepub fn map<SNext>(self) -> RpcClient<S, C, SNext>
pub fn map<SNext>(self) -> RpcClient<S, C, SNext>
Map this channel’s service into an inner service.
This method is available if the required bounds are upheld: SNext::Req: IntoSInner::Req + TryFromSInner::Req, SNext::Res: IntoSInner::Res + TryFromSInner::Res,
Where SNext is the new service to map to and SInner is the current inner service.
This method can be chained infintely.
source§impl<S, C, SInner> RpcClient<S, C, SInner>
impl<S, C, SInner> RpcClient<S, C, SInner>
sourcepub async fn bidi<M>(
&self,
msg: M,
) -> Result<(UpdateSink<S, C, M::Update, SInner>, BoxStreamSync<'static, Result<M::Response, ItemError<C>>>), Error<C>>where
M: BidiStreamingMsg<SInner>,
pub async fn bidi<M>(
&self,
msg: M,
) -> Result<(UpdateSink<S, C, M::Update, SInner>, BoxStreamSync<'static, Result<M::Response, ItemError<C>>>), Error<C>>where
M: BidiStreamingMsg<SInner>,
Bidi call to the server, request opens a stream, response is a stream
source§impl<S, C, SInner> RpcClient<S, C, SInner>
impl<S, C, SInner> RpcClient<S, C, SInner>
sourcepub async fn client_streaming<M>(
&self,
msg: M,
) -> Result<(UpdateSink<S, C, M::Update, SInner>, Boxed<Result<M::Response, ItemError<C>>>), Error<C>>where
M: ClientStreamingMsg<SInner>,
pub async fn client_streaming<M>(
&self,
msg: M,
) -> Result<(UpdateSink<S, C, M::Update, SInner>, Boxed<Result<M::Response, ItemError<C>>>), Error<C>>where
M: ClientStreamingMsg<SInner>,
Call to the server that allows the client to stream, single response
source§impl<S, C, SInner> RpcClient<S, C, SInner>
impl<S, C, SInner> RpcClient<S, C, SInner>
sourcepub async fn server_streaming<M>(
&self,
msg: M,
) -> Result<BoxStreamSync<'static, Result<M::Response, ItemError<C>>>, Error<C>>where
M: ServerStreamingMsg<SInner>,
pub async fn server_streaming<M>(
&self,
msg: M,
) -> Result<BoxStreamSync<'static, Result<M::Response, ItemError<C>>>, Error<C>>where
M: ServerStreamingMsg<SInner>,
Bidi call to the server, request opens a stream, response is a stream
source§impl<S, C, SInner> RpcClient<S, C, SInner>
impl<S, C, SInner> RpcClient<S, C, SInner>
sourcepub async fn try_server_streaming<M>(
&self,
msg: M,
) -> Result<BoxStreamSync<'static, Result<M::Item, ItemError<C, M::ItemError>>>, Error<C, M::CreateError>>where
M: TryServerStreamingMsg<SInner>,
Result<M::Item, M::ItemError>: Into<SInner::Res> + TryFrom<SInner::Res>,
Result<StreamCreated, M::CreateError>: Into<SInner::Res> + TryFrom<SInner::Res>,
pub async fn try_server_streaming<M>(
&self,
msg: M,
) -> Result<BoxStreamSync<'static, Result<M::Item, ItemError<C, M::ItemError>>>, Error<C, M::CreateError>>where
M: TryServerStreamingMsg<SInner>,
Result<M::Item, M::ItemError>: Into<SInner::Res> + TryFrom<SInner::Res>,
Result<StreamCreated, M::CreateError>: Into<SInner::Res> + TryFrom<SInner::Res>,
Bidi call to the server, request opens a stream, response is a stream