Expand description
Basic functions for dealing with memory.
This module contains functions for querying the size and alignment of types, initializing and manipulating memory.
Modules
Macros
- offset_ofExperimentalExpands to the offset in bytes of a field from the beginning of the given type.
Structs
- AssumeExperimentalWhat transmutation safety conditions shall the compiler assume that you are checking?
- Opaque type representing the discriminant of an enum.
- A wrapper to inhibit compiler from automatically calling
T
’s destructor. This wrapper is 0-cost.
Traits
- BikeshedIntrinsicFromExperimentalAre values of a type transmutable into values of another type?
- SizedTypePropertiesExperimentalProvides associated constants for various useful properties of types, to give them a canonical form in our code and make them easier to read.
Functions
- align_of_val_raw⚠ExperimentalReturns the ABI-required minimum alignment of the type of the value that
val
points to in bytes. - copyExperimentalBitwise-copies a value.
- forget_unsizedExperimentalLike
forget
, but also accepts unsized values. - size_of_val_raw⚠ExperimentalReturns the size of the pointed-to value in bytes.
- Returns a value uniquely identifying the enum variant in
v
. - Disposes of a value.
- Moves
src
into the referenceddest
, returning the previousdest
value. - Swaps the values at two mutable locations, without deinitializing either one.
- Same as
swap
semantically, but always uses the simple implementation. - variant_countExperimentalReturns the number of variants in the enum type
T
. - Returns the ABI-required minimum alignment of a type in bytes.
- Returns the ABI-required minimum alignment of the type of the value that
val
points to in bytes. - Takes ownership and “forgets” about the value without running its destructor.
- min_align_ofDeprecatedReturns the ABI-required minimum alignment of a type in bytes.
- min_align_of_valDeprecatedReturns the ABI-required minimum alignment of the type of the value that
val
points to in bytes. - Returns
true
if dropping values of typeT
matters. - Returns the size of a type in bytes.
- Returns the size of the pointed-to value in bytes.
- Replaces
dest
with the default value ofT
, returning the previousdest
value. - Reinterprets the bits of a value of one type as another type.
- Interprets
src
as having type&Dst
, and then readssrc
without moving the contained value. - uninitialized⚠DeprecatedBypasses Rust’s normal memory-initialization checks by pretending to produce a value of type
T
, while doing nothing at all. - Returns the value of type
T
represented by the all-zero byte-pattern.
Unions
- A wrapper type to construct uninitialized instances of
T
.