From a586def25bebbb98c703c8d065323c71cce2a69f Mon Sep 17 00:00:00 2001 From: John Rinehart Date: Thu, 30 Nov 2023 21:23:46 -0800 Subject: [PATCH 1/2] feat: add methods to builder for changing timeouts --- src/lib.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 8339af66..33969145 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -485,6 +485,27 @@ impl OctocrabBuilder self } + /// Set the connect timeout. + #[cfg(feature = "timeout")] + pub fn set_connect_timeout(mut self, timeout: Option) -> Self { + self.config.connect_timeout = timeout; + self + } + + /// Set the read timeout. + #[cfg(feature = "timeout")] + pub fn set_read_timeout(mut self, timeout: Option) -> Self { + self.config.read_timeout = timeout; + self + } + + /// Set the write timeout. + #[cfg(feature = "timeout")] + pub fn set_write_timeout(mut self, timeout: Option) -> Self { + self.config.write_timeout = timeout; + self + } + /// Enable a GitHub preview. pub fn add_preview(mut self, preview: &'static str) -> Self { self.config.previews.push(preview); From f1c94c14e250cf7543a8f9bae273613ef5f7ae55 Mon Sep 17 00:00:00 2001 From: John Rinehart Date: Fri, 1 Dec 2023 11:44:59 -0800 Subject: [PATCH 2/2] chore: remove unnecessary feature flag --- src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 33969145..3089cf58 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -486,21 +486,18 @@ impl OctocrabBuilder } /// Set the connect timeout. - #[cfg(feature = "timeout")] pub fn set_connect_timeout(mut self, timeout: Option) -> Self { self.config.connect_timeout = timeout; self } /// Set the read timeout. - #[cfg(feature = "timeout")] pub fn set_read_timeout(mut self, timeout: Option) -> Self { self.config.read_timeout = timeout; self } /// Set the write timeout. - #[cfg(feature = "timeout")] pub fn set_write_timeout(mut self, timeout: Option) -> Self { self.config.write_timeout = timeout; self