Skip to content

Commit

Permalink
docs: update readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
snormore committed Apr 25, 2024
1 parent 1c4492a commit c928d9d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,17 @@ fn main() {
{
let value = cell.borrow();
assert_eq!(*value, 42);

// Cannot borrow mutably when already borrowed immutably
assert!(cell.try_borrow_mut().is_none());
}

{
let mut value = cell.borrow_mut();
*value = 45;

// Cannot borrow when already borrowed mutably
assert!(cell.try_borrow().is_none());
}

{
Expand Down

0 comments on commit c928d9d

Please sign in to comment.