Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokio: add builder function for watch::Sender #5998

Merged
merged 6 commits into from
Sep 19, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix docs code example
nicflower committed Sep 12, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
nicflower Nicola Fiorella
commit 7012700e7ee0fcae6e265872945efca1fd7a2f38
7 changes: 4 additions & 3 deletions tokio/src/sync/watch.rs
Original file line number Diff line number Diff line change
@@ -866,9 +866,10 @@ impl<T> Sender<T> {
/// # Examples
/// ```
/// let sender = tokio::sync::watch::Sender::new(0u8);
/// assert!(sender.send(3).is_err())
/// let _rec = sender.subscribe()
/// assert!(sender.send(4).is_ok())
/// assert!(sender.send(3).is_err());
/// let _rec = sender.subscribe();
/// assert!(sender.send(4).is_ok());
/// ```
pub fn new(init: T) -> Self {
let (tx, _) = channel(init);
tx