Skip to content

Commit

Permalink
tonic: fix consistency issue with timeout func in transport/server bu…
Browse files Browse the repository at this point in the history
…ilder

transport/server/mod.rs exposes a Builder for the Server, and most of the
Builder functions return Self (a change made for issue #115), but timeout
returns mut& Self. This change makes timeout consistent with the rest of
the Builder api by returning Self.

Fixes: #900
Refs: #115
  • Loading branch information
jdahlq committed Jan 30, 2022
1 parent a337f13 commit 0f20b7e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tonic/src/transport/server/mod.rs
Expand Up @@ -186,12 +186,14 @@ impl<L> Server<L> {
/// # use tonic::transport::Server;
/// # use tower_service::Service;
/// # use std::time::Duration;
/// # let mut builder = Server::builder();
/// # let builder = Server::builder();
/// builder.timeout(Duration::from_secs(30));
/// ```
pub fn timeout(&mut self, timeout: Duration) -> &mut Self {
self.timeout = Some(timeout);
self
pub fn timeout(self, timeout: Duration) -> Self {
Server {
timeout: Some(timeout),
..self
}
}

/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
Expand Down

0 comments on commit 0f20b7e

Please sign in to comment.