Skip to content

Commit adbe294

Browse files
authored
Merge pull request #395 from yoshidan/add_deprecated
[pubsub] Make `subscription.receive` deprecated
2 parents 2db3af7 + 5f16823 commit adbe294

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

pubsub/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gcloud-pubsub"
3-
version = "1.4.0"
3+
version = "1.4.1"
44
authors = ["yoshidan <naohiro.y@gmail.com>"]
55
edition = "2021"
66
repository = "https://github.com/yoshidan/google-cloud-rust/tree/main/pubsub"

pubsub/src/client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ impl Client {
278278
}
279279
}
280280

281+
#[allow(deprecated)]
281282
#[cfg(test)]
282283
mod tests {
283284
use std::collections::HashMap;

pubsub/src/subscription.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,15 @@ impl Subscription {
491491
/// receive calls f with the outstanding messages from the subscription.
492492
/// It blocks until cancellation token is cancelled, or the service returns a non-retryable error.
493493
/// The standard way to terminate a receive is to use CancellationToken.
494+
///
495+
/// # Deprecated
496+
/// Deprecated since 1.4.1.
497+
/// This method will be removed in **1.5.0**.
498+
/// Please use [`subscribe`] instead.
499+
#[deprecated(
500+
since = "1.4.1",
501+
note = "This will be removed in 1.5.0. Please use `subscribe` method to get a stream of messages and process the messages from the stream."
502+
)]
494503
pub async fn receive<F>(
495504
&self,
496505
f: impl Fn(ReceivedMessage, CancellationToken) -> F + Send + 'static + Sync + Clone,
@@ -707,7 +716,9 @@ fn create_channel(
707716
}
708717

709718
#[cfg(test)]
719+
#[allow(deprecated)]
710720
mod tests {
721+
711722
use std::collections::HashMap;
712723
use std::sync::atomic::AtomicU32;
713724
use std::sync::atomic::Ordering::SeqCst;

0 commit comments

Comments
 (0)