|
10 | 10 |
|
11 | 11 | // FIXME: talk about offset, copy_memory, copy_nonoverlapping_memory |
12 | 12 |
|
13 | | -//! Conveniences for working with unsafe pointers, the `*T`, and `*mut T` types. |
| 13 | +//! Operations on unsafe pointers, `*T`, and `*mut T`. |
14 | 14 | //! |
15 | | -//! Working with unsafe pointers in Rust is fairly uncommon, |
16 | | -//! and often limited to some narrow use cases: holding |
17 | | -//! an unsafe pointer when safe pointers are unsuitable; |
18 | | -//! checking for null; and converting back to safe pointers. |
19 | | -//! As a result, there is not yet an abundance of library code |
20 | | -//! for working with unsafe pointers, and in particular, |
21 | | -//! since pointer math is fairly uncommon in Rust, it is not |
22 | | -//! all that convenient. |
| 15 | +//! Working with unsafe pointers in Rust is uncommon, |
| 16 | +//! typically limited to a few patterns. |
23 | 17 | //! |
24 | 18 | //! Use the [`null` function](fn.null.html) to create null pointers, |
25 | 19 | //! the [`is_null`](trait.RawPtr.html#tymethod.is_null) |
26 | 20 | //! and [`is_not_null`](trait.RawPtr.html#method.is_not_null) |
27 | 21 | //! methods of the [`RawPtr` trait](trait.RawPtr.html) to check for null. |
28 | 22 | //! The `RawPtr` trait is imported by the prelude, so `is_null` etc. |
29 | | -//! work everywhere. |
| 23 | +//! work everywhere. The `RawPtr` also defines the `offset` method, |
| 24 | +//! for pointer math. |
30 | 25 | //! |
31 | 26 | //! # Common ways to create unsafe pointers |
32 | 27 | //! |
@@ -316,7 +311,7 @@ pub unsafe fn array_each<T>(arr: **T, cb: |*T|) { |
316 | 311 | array_each_with_len(arr, len, cb); |
317 | 312 | } |
318 | 313 |
|
319 | | -/// Extension methods for raw pointers. |
| 314 | +/// Methods on raw pointers |
320 | 315 | pub trait RawPtr<T> { |
321 | 316 | /// Returns the null pointer. |
322 | 317 | fn null() -> Self; |
|
0 commit comments