doc.rust-lang.org
pub mod alloc
The Rust core allocation and collections library
module
alloc
Stable since 1.36.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod alloc
Memory allocation APIs
module
alloc
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn alloc(layout: Layout) -> *mut u8
Allocates memory with the global allocator.
function
alloc
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8
Allocates zero-initialized memory with the global allocator.
function
alloc
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn dealloc(ptr: *mut u8, layout: Layout)
Deallocates memory with the global allocator.
function
alloc
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn handle_alloc_error(layout: Layout) -> never
Signals a memory allocation error.
function
alloc
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
Reallocates memory with the global allocator.
function
alloc
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod borrow
A module for working with borrowed data.
module
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub enum Cow<'a, B>
A clone-on-write smart pointer.
enum
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_owned(self) -> <B as ToOwned>::Owned
Extracts the owned data.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned
Acquires a mutable reference to the owned form of the data.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub trait ToOwned
A generalization of Clone to borrowed data.
trait
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
type Owned
The resulting type after obtaining ownership.
associated_type
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
fn clone_into(&self, target: &mut <Self as >::Owned)
Uses borrowed data to replace owned data, usually by cloning.
method
alloc
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
fn to_owned(&self) -> <Self as >::Owned
Creates owned data from borrowed data, usually by cloning.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod boxed
The Box<T> type for heap allocation.
module
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Box<T, A>
A pointer type that uniquely owns a heap allocation of type T.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_mut_ptr(b: &mut Self) -> *mut T
Returns a raw mutable pointer to the Box's contents.
associated_function
alloc
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_ptr(b: &Self) -> *const T
Returns a raw pointer to the Box's contents.
associated_function
alloc
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn assume_init(self) -> Box<T, A>
Converts to Box<T, A>.
method
alloc
Stable since 1.82.0
Version 1.100.0-nightly