[−][src]Struct tonic::client::Grpc  
A gRPC client dispatcher.
This will wrap some inner [GrpcService] and will encode/decode
messages via the provided codec.
Each request method takes a [Request], a [PathAndQuery], and a
[Codec]. The request contains the message to send via the
[Codec::encoder]. The path determines the fully qualified path
that will be append to the outgoing uri. The path must follow
the conventions explained in the gRPC protocol definition under Path →. An
example of this path could look like /greeter.Greeter/SayHello.
Methods
impl<T> Grpc<T>[src]
pub fn new(inner: T) -> Self[src]
Creates a new gRPC client with the provided [GrpcService].
pub fn with_interceptor(inner: T, interceptor: impl Into<Interceptor>) -> Self[src]
Creates a new gRPC client with the provided [GrpcService] and will apply
the provided interceptor on each request.
pub async fn ready<'_>(&'_ mut self) -> Result<(), T::Error> where
    T: GrpcService<BoxBody>, [src]
T: GrpcService<BoxBody>,
Check if the inner [GrpcService] is able to accept a  new request.
This will call [GrpcService::poll_ready] until it returns ready or
an error. If this returns ready the inner [GrpcService] is ready to
accept one more request.
pub async fn unary<'_, M1, M2, C>(
    &'_ mut self, 
    request: Request<M1>, 
    path: PathAndQuery, 
    codec: C
) -> Result<Response<M2>, Status> where
    T: GrpcService<BoxBody>,
    T::ResponseBody: Body + HttpBody + Send + 'static,
    <T::ResponseBody as HttpBody>::Error: Into<Box<dyn Error + Send + Sync>>,
    C: Codec<Encode = M1, Decode = M2>,
    M1: Send + Sync + 'static,
    M2: Send + Sync + 'static, [src]
&'_ mut self,
request: Request<M1>,
path: PathAndQuery,
codec: C
) -> Result<Response<M2>, Status> where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
<T::ResponseBody as HttpBody>::Error: Into<Box<dyn Error + Send + Sync>>,
C: Codec<Encode = M1, Decode = M2>,
M1: Send + Sync + 'static,
M2: Send + Sync + 'static,
Send a single unary gRPC request.
pub async fn client_streaming<'_, S, M1, M2, C>(
    &'_ mut self, 
    request: Request<S>, 
    path: PathAndQuery, 
    codec: C
) -> Result<Response<M2>, Status> where
    T: GrpcService<BoxBody>,
    T::ResponseBody: Body + HttpBody + Send + 'static,
    <T::ResponseBody as HttpBody>::Error: Into<Box<dyn Error + Send + Sync>>,
    S: Stream<Item = M1> + Send + Sync + 'static,
    C: Codec<Encode = M1, Decode = M2>,
    M1: Send + Sync + 'static,
    M2: Send + Sync + 'static, [src]
&'_ mut self,
request: Request<S>,
path: PathAndQuery,
codec: C
) -> Result<Response<M2>, Status> where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
<T::ResponseBody as HttpBody>::Error: Into<Box<dyn Error + Send + Sync>>,
S: Stream<Item = M1> + Send + Sync + 'static,
C: Codec<Encode = M1, Decode = M2>,
M1: Send + Sync + 'static,
M2: Send + Sync + 'static,
Send a client side streaming gRPC request.
pub async fn server_streaming<'_, M1, M2, C>(
    &'_ mut self, 
    request: Request<M1>, 
    path: PathAndQuery, 
    codec: C
) -> Result<Response<Streaming<M2>>, Status> where
    T: GrpcService<BoxBody>,
    T::ResponseBody: Body + HttpBody + Send + 'static,
    <T::ResponseBody as HttpBody>::Error: Into<Box<dyn Error + Send + Sync>>,
    C: Codec<Encode = M1, Decode = M2>,
    M1: Send + Sync + 'static,
    M2: Send + Sync + 'static, [src]
&'_ mut self,
request: Request<M1>,
path: PathAndQuery,
codec: C
) -> Result<Response<Streaming<M2>>, Status> where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
<T::ResponseBody as HttpBody>::Error: Into<Box<dyn Error + Send + Sync>>,
C: Codec<Encode = M1, Decode = M2>,
M1: Send + Sync + 'static,
M2: Send + Sync + 'static,
Send a server side streaming gRPC request.
pub async fn streaming<'_, S, M1, M2, C>(
    &'_ mut self, 
    request: Request<S>, 
    path: PathAndQuery, 
    __arg3: C
) -> Result<Response<Streaming<M2>>, Status> where
    T: GrpcService<BoxBody>,
    T::ResponseBody: Body + HttpBody + Send + 'static,
    <T::ResponseBody as HttpBody>::Error: Into<Box<dyn Error + Send + Sync>>,
    S: Stream<Item = M1> + Send + Sync + 'static,
    C: Codec<Encode = M1, Decode = M2>,
    M1: Send + Sync + 'static,
    M2: Send + Sync + 'static, [src]
&'_ mut self,
request: Request<S>,
path: PathAndQuery,
__arg3: C
) -> Result<Response<Streaming<M2>>, Status> where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
<T::ResponseBody as HttpBody>::Error: Into<Box<dyn Error + Send + Sync>>,
S: Stream<Item = M1> + Send + Sync + 'static,
C: Codec<Encode = M1, Decode = M2>,
M1: Send + Sync + 'static,
M2: Send + Sync + 'static,
Send a bi-directional streaming gRPC request.
Trait Implementations
impl<T: Clone> Clone for Grpc<T>[src]
fn clone(&self) -> Self[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T: Debug> Debug for Grpc<T>[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for Grpc<T>
impl<T> Send for Grpc<T> where
    T: Send, 
T: Send,
impl<T> Sync for Grpc<T> where
    T: Sync, 
T: Sync,
impl<T> Unpin for Grpc<T> where
    T: Unpin, 
T: Unpin,
impl<T> !UnwindSafe for Grpc<T>
Blanket Implementations
impl<T> Any for T where
    T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
    T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
    T: ?Sized, [src]
T: ?Sized,
ⓘImportant traits for &'_ mut Ffn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
ⓘImportant traits for Instrumented<T>fn instrument(self, span: Span) -> Instrumented<Self>[src]
ⓘImportant traits for Instrumented<T>fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
    U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
    T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
    U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
    V: MultiLane<T>, [src]
V: MultiLane<T>,
impl<T> WithSubscriber for T[src]
ⓘImportant traits for WithDispatch<T>fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, [src]
S: Into<Dispatch>,