Module mem
Basic functions for dealing with memory.
This module contains functions for querying the size and alignment of types, initializing and manipulating memory.
Modules
- type_info MVP for exposing compile-time information about types in a runtime or const-eval processable way.
Structs
- Discriminant Opaque type representing the discriminant of an enum.
Functions
- align_of Returns the ABI-required minimum alignment of a type in bytes.
-
align_of_val
Returns the ABI-required minimum alignment of the type of the value that
valpoints to in bytes. -
align_of_val_raw
Returns the ABI-required minimum alignment of the type of the value that
valpoints to in bytes. -
conjure_zst
Create a fresh instance of the inhabited ZST type
T. - copy Bitwise-copies a value.
-
discriminant
Returns a value uniquely identifying the enum variant in
v. - drop Disposes of a value.
- forget Takes ownership and "forgets" about the value without running its destructor.
-
forget_unsized
Like
forget, but also accepts unsized values. - min_align_of Returns the ABI-required minimum alignment of a type in bytes.
-
min_align_of_val
Returns the ABI-required minimum alignment of the type of the value that
valpoints to in bytes. -
needs_drop
Returns
trueif dropping values of typeTmatters. -
replace
Moves
srcinto the referenceddest, returning the previousdestvalue. - size_of Returns the size of a type in bytes.
- size_of_val Returns the size of the pointed-to value in bytes.
- size_of_val_raw Returns the size of the pointed-to value in bytes.
- swap Swaps the values at two mutable locations, without deinitializing either one.
-
take
Replaces
destwith the default value ofT, returning the previousdestvalue. -
transmute_copy
Interprets
srcas having type&Dst, and then readssrcwithout moving the contained value. -
uninitialized
Bypasses Rust's normal memory-initialization checks by pretending to
produce a value of type
T, while doing nothing at all. -
variant_count
Returns the number of variants in the enum type
T. -
zeroed
Returns the value of type
Trepresented by the all-zero byte-pattern.
Macros
- offset_of Expands to the offset in bytes of a field from the beginning of the given type.