Skip to content

Commit

Permalink
Improve as_mut ptr method example
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Apr 17, 2016
1 parent a626400 commit 4d0b0e9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libcore/ptr.rs
Expand Up @@ -459,6 +459,9 @@ impl<T: ?Sized> *mut T {
/// ```
/// let mut s = [1, 2, 3];
/// let ptr: *mut u32 = s.as_mut_ptr();
/// let first_value = unsafe { ptr.as_mut().unwrap() };
/// *first_value = 4;
/// println!("{:?}", s); // It'll print: "[4, 2, 3]".
/// ```
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
#[inline]
Expand Down

0 comments on commit 4d0b0e9

Please sign in to comment.