pub trait ServiceClientExt: ServiceClient + Sized {
// Provided methods
fn with_outbound_compression(self, encoding: Encoding) -> Self { ... }
fn set_outbound_compression(&mut self, encoding: Encoding) -> &mut Self { ... }
fn outbound_compression(&self) -> Encoding { ... }
fn with_default_timeout(self, duration: Duration) -> Self { ... }
fn set_default_timeout(&mut self, duration: Duration) -> &mut Self { ... }
fn default_timeout(&self) -> Option<Duration> { ... }
}Expand description
Builder-style configuration available on every service client.
Implemented for any T: ServiceClient + Sized, so service clients
don’t reimplement these — they just impl ServiceClient and inherit
the full set.
Provided Methods§
Sourcefn with_outbound_compression(self, encoding: Encoding) -> Self
fn with_outbound_compression(self, encoding: Encoding) -> Self
Compress every outgoing request body with this codec. Sent on the
wire as grpc-encoding: <codec>.
The server is required by spec to handle whatever the client sends
— including failing with Unimplemented — so picking a codec your
server is known to support is the caller’s responsibility. The
server’s grpc-accept-encoding (visible after the first response)
can be inspected by the caller to pick a future-safe codec.
Setting Encoding::Identity clears any previously-set compression.
Sourcefn set_outbound_compression(&mut self, encoding: Encoding) -> &mut Self
fn set_outbound_compression(&mut self, encoding: Encoding) -> &mut Self
&mut form of with_outbound_compression.
Sourcefn outbound_compression(&self) -> Encoding
fn outbound_compression(&self) -> Encoding
The currently-configured outbound compression. Identity if none
has been set.
Sourcefn with_default_timeout(self, duration: Duration) -> Self
fn with_default_timeout(self, duration: Duration) -> Self
Apply this duration as the default deadline on every call. Sent on
the wire as grpc-timeout: <unit> so the server can enforce the
same deadline; the client also races its own dispatch future
against a local timer so we fail fast even if the server is unable
to respond.
Setting Duration::ZERO clears any previously-set deadline.
Sourcefn set_default_timeout(&mut self, duration: Duration) -> &mut Self
fn set_default_timeout(&mut self, duration: Duration) -> &mut Self
&mut form of with_default_timeout.
Sourcefn default_timeout(&self) -> Option<Duration>
fn default_timeout(&self) -> Option<Duration>
The currently-configured default timeout, if any.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".