Skip to content

Commit

Permalink
Clarify the docs for Cell::update
Browse files Browse the repository at this point in the history
  • Loading branch information
Stjepan Glavina committed Apr 23, 2018
1 parent 5dcce51 commit 1c0db24
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libcore/cell.rs
Expand Up @@ -257,7 +257,7 @@ impl<T:Copy> Cell<T> {
unsafe{ *self.value.get() }
}

/// Applies a function to the contained value.
/// Updates the contained value using a function and returns the new value.
///
/// # Examples
///
Expand All @@ -267,8 +267,9 @@ impl<T:Copy> Cell<T> {
/// use std::cell::Cell;
///
/// let c = Cell::new(5);
/// c.update(|x| x + 1);
/// let new = c.update(|x| x + 1);
///
/// assert_eq!(new, 6);
/// assert_eq!(c.get(), 6);
/// ```
#[inline]
Expand Down

0 comments on commit 1c0db24

Please sign in to comment.