|
10 | 10 | //! |
11 | 11 | //! ## Boxed values |
12 | 12 | //! |
13 | | -//! The [`Box`](boxed/index.html) type is a smart pointer type. There can |
14 | | -//! only be one owner of a `Box`, and the owner can decide to mutate the |
15 | | -//! contents, which live on the heap. |
| 13 | +//! The [`Box`] type is a smart pointer type. There can only be one owner of a |
| 14 | +//! [`Box`], and the owner can decide to mutate the contents, which live on the |
| 15 | +//! heap. |
16 | 16 | //! |
17 | 17 | //! This type can be sent among threads efficiently as the size of a `Box` value |
18 | 18 | //! is the same as that of a pointer. Tree-like data structures are often built |
19 | 19 | //! with boxes because each node often has only one owner, the parent. |
20 | 20 | //! |
21 | 21 | //! ## Reference counted pointers |
22 | 22 | //! |
23 | | -//! The [`Rc`](rc/index.html) type is a non-threadsafe reference-counted pointer |
24 | | -//! type intended for sharing memory within a thread. An `Rc` pointer wraps a |
25 | | -//! type, `T`, and only allows access to `&T`, a shared reference. |
| 23 | +//! The [`Rc`] type is a non-threadsafe reference-counted pointer type intended |
| 24 | +//! for sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and |
| 25 | +//! only allows access to `&T`, a shared reference. |
26 | 26 | //! |
27 | | -//! This type is useful when inherited mutability (such as using `Box`) is too |
28 | | -//! constraining for an application, and is often paired with the `Cell` or |
29 | | -//! `RefCell` types in order to allow mutation. |
| 27 | +//! This type is useful when inherited mutability (such as using [`Box`]) is too |
| 28 | +//! constraining for an application, and is often paired with the [`Cell`] or |
| 29 | +//! [`RefCell`] types in order to allow mutation. |
30 | 30 | //! |
31 | 31 | //! ## Atomically reference counted pointers |
32 | 32 | //! |
33 | | -//! The [`Arc`](sync/index.html) type is the threadsafe equivalent of the `Rc` |
34 | | -//! type. It provides all the same functionality of `Rc`, except it requires |
35 | | -//! that the contained type `T` is shareable. Additionally, `Arc<T>` is itself |
36 | | -//! sendable while `Rc<T>` is not. |
| 33 | +//! The [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It |
| 34 | +//! provides all the same functionality of [`Rc`], except it requires that the |
| 35 | +//! contained type `T` is shareable. Additionally, [`Arc<T>`][`Arc`] is itself |
| 36 | +//! sendable while [`Rc<T>`][`Rc`] is not. |
37 | 37 | //! |
38 | 38 | //! This type allows for shared access to the contained data, and is often |
39 | 39 | //! paired with synchronization primitives such as mutexes to allow mutation of |
|
49 | 49 | //! |
50 | 50 | //! The [`alloc`](alloc/index.html) module defines the low-level interface to the |
51 | 51 | //! default global allocator. It is not compatible with the libc allocator API. |
| 52 | +//! |
| 53 | +//! [`Arc`]: sync/index.html |
| 54 | +//! [`Box`]: boxed/index.html |
| 55 | +//! [`Cell`]: ../core/cell/index.html |
| 56 | +//! [`Rc`]: rc/index.html |
| 57 | +//! [`RefCell`]: ../core/cell/index.html |
52 | 58 |
|
53 | 59 | #![allow(unused_attributes)] |
54 | 60 | #![stable(feature = "alloc", since = "1.36.0")] |
|
0 commit comments