|
12 | 12 |
|
13 | 13 | //! Threadsafe reference-counted boxes (the `Arc<T>` type).
|
14 | 14 | //!
|
15 |
| -//! The `Arc<T>` type provides shared ownership of an immutable value. Destruction is |
16 |
| -//! deterministic, and will occur as soon as the last owner is gone. It is marked as `Send` because |
17 |
| -//! it uses atomic reference counting. |
| 15 | +//! The `Arc<T>` type provides shared ownership of an immutable value. |
| 16 | +//! Destruction is deterministic, and will occur as soon as the last owner is |
| 17 | +//! gone. It is marked as `Send` because it uses atomic reference counting. |
18 | 18 | //!
|
19 |
| -//! If you do not need thread-safety, and just need shared ownership, consider the [`Rc<T>` |
20 |
| -//! type](../rc/struct.Rc.html). It is the same as `Arc<T>`, but does not use atomics, making it |
21 |
| -//! both thread-unsafe as well as significantly faster when updating the reference count. |
| 19 | +//! If you do not need thread-safety, and just need shared ownership, consider |
| 20 | +//! the [`Rc<T>` type](../rc/struct.Rc.html). It is the same as `Arc<T>`, but |
| 21 | +//! does not use atomics, making it both thread-unsafe as well as significantly |
| 22 | +//! faster when updating the reference count. |
22 | 23 | //!
|
23 |
| -//! The `downgrade` method can be used to create a non-owning `Weak<T>` pointer to the box. A |
24 |
| -//! `Weak<T>` pointer can be upgraded to an `Arc<T>` pointer, but will return `None` if the value |
25 |
| -//! has already been dropped. |
| 24 | +//! The `downgrade` method can be used to create a non-owning `Weak<T>` pointer |
| 25 | +//! to the box. A `Weak<T>` pointer can be upgraded to an `Arc<T>` pointer, but |
| 26 | +//! will return `None` if the value has already been dropped. |
26 | 27 | //!
|
27 |
| -//! For example, a tree with parent pointers can be represented by putting the nodes behind strong |
28 |
| -//! `Arc<T>` pointers, and then storing the parent pointers as `Weak<T>` pointers. |
| 28 | +//! For example, a tree with parent pointers can be represented by putting the |
| 29 | +//! nodes behind strong `Arc<T>` pointers, and then storing the parent pointers |
| 30 | +//! as `Weak<T>` pointers. |
29 | 31 | //!
|
30 | 32 | //! # Examples
|
31 | 33 | //!
|
@@ -87,8 +89,9 @@ use heap::deallocate;
|
87 | 89 | ///
|
88 | 90 | /// # Example
|
89 | 91 | ///
|
90 |
| -/// In this example, a large vector of floats is shared between several tasks. With simple pipes, |
91 |
| -/// without `Arc`, a copy would have to be made for each task. |
| 92 | +/// In this example, a large vector of floats is shared between several tasks. |
| 93 | +/// With simple pipes, without `Arc`, a copy would have to be made for each |
| 94 | +/// task. |
92 | 95 | ///
|
93 | 96 | /// ```rust
|
94 | 97 | /// use std::sync::Arc;
|
|
0 commit comments