pub struct RequestTimeouts { /* private fields */ }Expand description
Client-side time limits for a gRPC call. Both are off by default.
Set them for every call of a client with
GoogleApiClient::with_request_timeouts,
or for one call by inserting a value into the request’s extensions, which replaces both
limits of the client for that call, so RequestTimeouts::new() switches them off:
let mut request: tonic::Request<M> = tonic::Request::new(message);
request
.extensions_mut()
.insert(RequestTimeouts::new().with_total(Duration::from_secs(10)));A call that runs out of a limit fails with
Code::DeadlineExceeded, and the status’s source() is
a RequestTimeoutElapsed.
The limits bound the response body only when the service under the middleware answers
with a tonic::body::Body, as the channel of a
GoogleAuthMiddleware does. Over any other service they
bound the wait for the response headers alone.
Implementations§
Source§impl RequestTimeouts
impl RequestTimeouts
Sourcepub const fn with_total(self, total: Duration) -> Self
pub const fn with_total(self, total: Duration) -> Self
The longest the whole call may take, from the request, its authentication included, to the last response message and the trailers.
Sent to the server as grpc-timeout, so a server that honours it stops working on
the call too; a grpc-timeout the request already carries is kept. It ends a stream
however steadily the stream delivers, so it suits unary calls.
Sourcepub const fn with_idle(self, idle: Duration) -> Self
pub const fn with_idle(self, idle: Duration) -> Self
The longest the caller waits for the response to start and for each next part of the response, counted only while the caller is waiting for one. Not sent to the server.
It suits server streams. A stream that stays quiet until the client writes, such as a bidirectional stream, fails on it.
Trait Implementations§
Source§impl Clone for RequestTimeouts
impl Clone for RequestTimeouts
impl Copy for RequestTimeouts
Source§impl Debug for RequestTimeouts
impl Debug for RequestTimeouts
Source§impl Default for RequestTimeouts
impl Default for RequestTimeouts
impl Eq for RequestTimeouts
Source§impl PartialEq for RequestTimeouts
impl PartialEq for RequestTimeouts
impl StructuralPartialEq for RequestTimeouts
Auto Trait Implementations§
impl Freeze for RequestTimeouts
impl RefUnwindSafe for RequestTimeouts
impl Send for RequestTimeouts
impl Sync for RequestTimeouts
impl Unpin for RequestTimeouts
impl UnsafeUnpin for RequestTimeouts
impl UnwindSafe for RequestTimeouts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request