core::ptr - Rust
Description: API documentation for the Rust `ptr` mod in crate `core`.
Keywords: rust, rustlang, rust-lang, ptr

# Module core::ptr 1.0.0 [−] [src]

Raw, unsafe pointers, `*const T`, and `*mut T`.

See also the pointer primitive types.

## Reexports

`pub use intrinsics::copy_nonoverlapping;`
`pub use intrinsics::copy;`
`pub use intrinsics::write_bytes;`
`pub use intrinsics::drop_in_place;`

## Structs

Shared | [ Experimental ] A wrapper around a raw non-null `*mut T` that indicates that the possessor of this wrapper has shared ownership of the referent. Useful for building abstractions like `Rc<T>` or `Arc<T>`, which internally use raw pointers to manage the memory that they own.
Unique | [ Experimental ] A wrapper around a raw non-null `*mut T` that indicates that the possessor of this wrapper owns the referent. This in turn implies that the `Unique<T>` is `Send`/`Sync` if `T` is `Send`/`Sync`, unlike a raw `*mut T` (which conveys no particular ownership semantics). It also implies that the referent of the pointer should not be modified without a unique path to the `Unique` reference. Useful for building abstractions like `Vec<T>` or `Box<T>`, which internally use raw pointers to manage the memory that they own.

## Functions

null | Creates a null raw pointer.
null_mut | Creates a null mutable raw pointer.
read⚠ | Reads the value from `src` without moving it. This leaves the memory in `src` unchanged.
read_volatile⚠ | Performs a volatile read of the value from `src` without moving it. This leaves the memory in `src` unchanged.
replace⚠ | Replaces the value at `dest` with `src`, returning the old value, without dropping either.
swap⚠ | Swaps the values at two mutable locations of the same type, without deinitializing either. They may overlap, unlike `mem::swap` which is otherwise equivalent.
write⚠ | Overwrites a memory location with the given value without reading or dropping the old value.
write_volatile⚠ | Performs a volatile write of a memory location with the given value without reading or dropping the old value.
eq | [ Experimental ] Compare raw pointers for equality.
read_unaligned⚠ | [ Experimental ] Reads the value from `src` without moving it. This leaves the memory in `src` unchanged.
write_unaligned⚠ | [ Experimental ] Overwrites a memory location with the given value without reading or dropping the old value.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)