1
Fork 0

Doc: explain why Box/Rc/Arc methods do not take self

This can be confusing for newcomers, especially due to the argument
name "this".
This commit is contained in:
Georg Brandl 2016-08-06 12:49:17 +02:00
parent 11946956a6
commit a068fc70ab
3 changed files with 16 additions and 0 deletions

View file

@ -71,6 +71,12 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
/// does not use atomics, making it both thread-unsafe as well as significantly
/// faster when updating the reference count.
///
/// Note: the inherent methods defined on `Arc<T>` are all associated functions,
/// which means that you have to call them as e.g. `Arc::get_mut(&value)`
/// instead of `value.get_mut()`. This is so that there are no conflicts with
/// methods on the inner type `T`, which are what you want to call in the
/// majority of cases.
///
/// # Examples
///
/// In this example, a large vector of data will be shared by several threads. First we