From dd8d06fbde0149f9e694b895c3c8fa890fc5e32f Mon Sep 17 00:00:00 2001 From: Suzy Mueller Date: Fri, 18 Sep 2026 20:02:55 +0000 Subject: [PATCH 1/2] feat(pubsub): support publish hedging --- librarian.yaml | 1 - src/pubsub/src/publisher/builder.rs | 22 ++++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/librarian.yaml b/librarian.yaml index fc41eb13cb..da0ececb18 100644 --- a/librarian.yaml +++ b/librarian.yaml @@ -1280,7 +1280,6 @@ libraries: version: 1.4.0 copyright_year: "2025" output: src/pubsub - skip_release: true rust: modules: - included_ids: diff --git a/src/pubsub/src/publisher/builder.rs b/src/pubsub/src/publisher/builder.rs index b6c7d27eb1..e38706429c 100644 --- a/src/pubsub/src/publisher/builder.rs +++ b/src/pubsub/src/publisher/builder.rs @@ -140,8 +140,8 @@ impl PublisherBuilder { /// .await?; /// # Ok(()) } /// ``` - pub fn set_hedging_options>(mut self, v: V) -> Self { - self.hedging_options = Some(v.into()); + pub fn set_hedging_options(mut self, v: HedgingOptions) -> Self { + self.hedging_options = Some(v); self } @@ -156,16 +156,13 @@ impl PublisherBuilder { /// # use google_cloud_pubsub::publisher::HedgingOptions; /// # async fn sample() -> anyhow::Result<()> { /// let publisher = Publisher::builder("projects/my-project/topics/my-topic") - /// .set_or_clear_hedging_options(None::) + /// .set_or_clear_hedging_options(None) /// .build() /// .await?; /// # Ok(()) } /// ``` - pub fn set_or_clear_hedging_options(mut self, v: Option) -> Self - where - V: Into, - { - self.hedging_options = v.map(Into::into); + pub fn set_or_clear_hedging_options(mut self, v: Option) -> Self { + self.hedging_options = v; self } @@ -460,7 +457,7 @@ impl PublisherPartialBuilder { /// .build(); /// # Ok(()) } /// ``` - pub fn set_hedging_options>(mut self, v: V) -> Self { + pub fn set_hedging_options(mut self, v: HedgingOptions) -> Self { self.hedging_options = Some(v.into()); self } @@ -478,14 +475,11 @@ impl PublisherPartialBuilder { /// # let client: BasePublisher = BasePublisher::builder().build().await?; /// let publisher = client /// .publisher("projects/my-project/topics/my-topic") - /// .set_or_clear_hedging_options(None::) + /// .set_or_clear_hedging_options(None) /// .build(); /// # Ok(()) } /// ``` - pub fn set_or_clear_hedging_options(mut self, v: Option) -> Self - where - V: Into, - { + pub fn set_or_clear_hedging_options(mut self, v: Option) -> Self { self.hedging_options = v.map(Into::into); self } From 5085404b87a3e445eefe2ba11030ddd51ddf657b Mon Sep 17 00:00:00 2001 From: Suzy Mueller Date: Fri, 18 Sep 2026 21:19:40 +0000 Subject: [PATCH 2/2] remove unnecessary into --- src/pubsub/src/publisher/builder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pubsub/src/publisher/builder.rs b/src/pubsub/src/publisher/builder.rs index e38706429c..65edce269b 100644 --- a/src/pubsub/src/publisher/builder.rs +++ b/src/pubsub/src/publisher/builder.rs @@ -458,7 +458,7 @@ impl PublisherPartialBuilder { /// # Ok(()) } /// ``` pub fn set_hedging_options(mut self, v: HedgingOptions) -> Self { - self.hedging_options = Some(v.into()); + self.hedging_options = Some(v); self } @@ -480,7 +480,7 @@ impl PublisherPartialBuilder { /// # Ok(()) } /// ``` pub fn set_or_clear_hedging_options(mut self, v: Option) -> Self { - self.hedging_options = v.map(Into::into); + self.hedging_options = v; self }