Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion librarian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,6 @@ libraries:
version: 1.4.0
copyright_year: "2025"
output: src/pubsub
skip_release: true
rust:
modules:
- included_ids:
Expand Down
26 changes: 10 additions & 16 deletions src/pubsub/src/publisher/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ impl PublisherBuilder {
/// .await?;
/// # Ok(()) }
/// ```
pub fn set_hedging_options<V: Into<HedgingOptions>>(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
}

Expand All @@ -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::<HedgingOptions>)
/// .set_or_clear_hedging_options(None)
/// .build()
/// .await?;
/// # Ok(()) }
/// ```
pub fn set_or_clear_hedging_options<V>(mut self, v: Option<V>) -> Self
where
V: Into<HedgingOptions>,
{
self.hedging_options = v.map(Into::into);
pub fn set_or_clear_hedging_options(mut self, v: Option<HedgingOptions>) -> Self {
self.hedging_options = v;
self
}

Expand Down Expand Up @@ -460,8 +457,8 @@ impl PublisherPartialBuilder {
/// .build();
/// # Ok(()) }
/// ```
pub fn set_hedging_options<V: Into<HedgingOptions>>(mut self, v: V) -> Self {
self.hedging_options = Some(v.into());
pub fn set_hedging_options(mut self, v: HedgingOptions) -> Self {
Comment thread
suzmue marked this conversation as resolved.
self.hedging_options = Some(v);
self
}

Expand All @@ -478,15 +475,12 @@ 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::<HedgingOptions>)
/// .set_or_clear_hedging_options(None)
/// .build();
/// # Ok(()) }
/// ```
pub fn set_or_clear_hedging_options<V>(mut self, v: Option<V>) -> Self
where
V: Into<HedgingOptions>,
{
self.hedging_options = v.map(Into::into);
pub fn set_or_clear_hedging_options(mut self, v: Option<HedgingOptions>) -> Self {
Comment thread
suzmue marked this conversation as resolved.

@dbolduc dbolduc Sep 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another argument for keeping the API is that an application might want to explicitly disable hedging in case the client library ever changes its default behavior.

self.hedging_options = v;
self
}

Expand Down
Loading