Skip to content

Commit

Permalink
fix docs code example
Browse files Browse the repository at this point in the history
  • Loading branch information
nicflower committed Sep 12, 2023
1 parent fed6789 commit 7012700
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tokio/src/sync/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7012700

Please sign in to comment.