update rustdocs for frozen

This commit is contained in:
Mark Mansi 2020-03-13 13:36:16 -05:00
parent da4e33a9e6
commit a58b17f2b5

View File

@ -1,4 +1,4 @@
//! An immutable, owned value.
//! An immutable, owned value (except for interior mutability).
//!
//! The purpose of `Frozen` is to make a value immutable for the sake of defensive programming. For example,
//! suppose we have the following:
@ -37,6 +37,12 @@
//! `Frozen` impls `Deref`, so we can ergonomically call methods on `Bar`, but it doesn't `impl
//! DerefMut`. Now calling `foo.compute.mutate()` will result in a compile-time error stating that
//! `mutate` requires a mutable reference but we don't have one.
//!
//! # Caveats
//!
//! - `Frozen` doesn't try to defend against interior mutability (e.g. `Frozen<RefCell<Bar>>`).
//! - `Frozen` doesn't pin it's contents (e.g. one could still do `foo.computed =
//! Frozen::freeze(new_bar)`).
/// An owned immutable value.
#[derive(Debug)]