Module std::mem[src]

Basic functions for dealing with memory

This module contains functions for querying the size and alignment of types, initializing and manipulating memory.

Functions

align_of

Returns the alignment in memory for a type.

align_of_val

Returns the alignment of the type of the value that _val points to.

copy_lifetime

Transforms lifetime of the second pointer to match the first.

copy_mut_lifetime

Transforms lifetime of the second mutable pointer to match the first.

drop

Disposes of a value.

forget

Moves a thing into the void.

from_be16

Convert an u16 from big endian to the target's endianness.

from_be32

Convert an u32 from big endian to the target's endianness.

from_be64

Convert an u64 from big endian to the target's endianness.

from_le16

Convert an u16 from little endian to the target's endianness.

from_le32

Convert an u32 from little endian to the target's endianness.

from_le64

Convert an u64 from little endian to the target's endianness.

init

Deprecated, use zeroed() instead

min_align_of

Returns the ABI-required minimum alignment of a type

min_align_of_val

Returns the ABI-required minimum alignment of the type of the value that _val points to

move_val_init

Deprecated, use overwrite instead

nonzero_size_of

Deprecated, this function will be removed soon

nonzero_size_of_val

Deprecated, this function will be removed soon

overwrite

Unsafely overwrite a memory location with the given value without destroying the old value.

pref_align_of

Deprecated, this function has been renamed to align_of

pref_align_of_val

Deprecated, this function has been renamed to align_of_val

replace

Replace the value at a mutable location with a new one, returning the old value, without deinitialising or copying either one.

size_of

Returns the size of a type in bytes.

size_of_val

Returns the size of the type that _val points to in bytes.

swap

Swap the values at two mutable locations of the same type, without deinitialising or copying either one.

to_be16

Convert an u16 to big endian from the target's endianness.

to_be32

Convert an u32 to big endian from the target's endianness.

to_be64

Convert an u64 to big endian from the target's endianness.

to_le16

Convert an u16 to little endian from the target's endianness.

to_le32

Convert an u32 to little endian from the target's endianness.

to_le64

Convert an u64 to little endian from the target's endianness.

transmute
transmute_copy

Interprets src as &U, and then reads src without moving the contained value.

uninit

Deprecated, use uninitialized instead.

uninitialized

Create an uninitialized value.

zeroed

Create a value initialized to zero.