Skip to content

Commit

Permalink
docs: add note regarding LazyCell::borrow_mut
Browse files Browse the repository at this point in the history
Add a notice in the documentation stating that `LazyCell::borrow_mut`
allows the mutation of the inner contents.
  • Loading branch information
indiv0 committed Sep 10, 2018
1 parent b807802 commit 9d634d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ use std::cell::UnsafeCell;
use std::sync::atomic::{AtomicUsize, Ordering};

/// A lazily filled `Cell`, with mutable contents.
///
/// A `LazyCell` is completely frozen once filled, **unless** you have `&mut`
/// access to it, in which case `LazyCell::borrow_mut` may be used to mutate the
/// contents.
#[derive(Debug, Default)]
pub struct LazyCell<T> {
inner: UnsafeCell<Option<T>>,
Expand Down

0 comments on commit 9d634d1

Please sign in to comment.