diff --git a/crates/rc-box/README.md b/crates/rc-box/README.md index abd5a7c..7285df3 100644 --- a/crates/rc-box/README.md +++ b/crates/rc-box/README.md @@ -7,6 +7,10 @@ With the standard library types, you would use `get_mut` and have to handle the case where the value was shared. With the known unique versions, you have `DerefMut`, so it's as simple as mutating behind a `Box`. +Also note that `RcBox`, unlike `Rc`, implements `Send` and `Sync`. An `RcBox` can be sent to +another thread or stored in a shared collection, and then converted to an `Rc` for optimal +single-threaded use. This works for `Rc` as well, since `RefCell` is `Send`. + ## Related Crates - [`erasable`](https://lib.rs/crates/erasable): Erase pointers of their concrete type. diff --git a/crates/rc-box/src/lib.rs b/crates/rc-box/src/lib.rs index bfe4e1a..42c9481 100644 --- a/crates/rc-box/src/lib.rs +++ b/crates/rc-box/src/lib.rs @@ -8,6 +8,10 @@ //! With the standard library types, you would use `get_mut` and have to handle the impossible //! case where the value was shared. With the known unique versions, you have [`DerefMut`], //! so it's as simple as mutating behind a [`Box`]. +//! +//! Also note that `RcBox`, unlike `Rc`, implements `Send` and `Sync`. An `RcBox` can be sent to +//! another thread or stored in a shared collection, and then converted to an `Rc` for optimal +//! single-threaded use. This works for `Rc` as well, since `RefCell` is `Send`. #![warn(missing_docs, missing_debug_implementations)] #![no_std]