Module mem

Module mem 

1.6.0 · Source
Expand description

Basic functions for dealing with memory.

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

Macros§

offset_ofNon-ferrocene_certified
Expands to the offset in bytes of a field from the beginning of the given type.

Structs§

DiscriminantNon-ferrocene_certified
Opaque type representing the discriminant of an enum.
ManuallyDropNon-ferrocene_certified
A wrapper to inhibit the compiler from automatically calling T’s destructor. This wrapper is 0-cost.
AssumeExperimentalNon-ferrocene_certified
Configurable proof assumptions of TransmuteFrom.
DropGuardExperimentalNon-ferrocene_certified
Wrap a value and run a closure when dropped.

Traits§

TransmuteFromExperimentalNon-ferrocene_certified
Marks that Src is transmutable into Self.

Functions§

align_of
Returns the ABI-required minimum alignment of a type in bytes.
align_of_valNon-ferrocene_certified
Returns the ABI-required minimum alignment of the type of the value that val points to in bytes.
discriminantNon-ferrocene_certified
Returns a value uniquely identifying the enum variant in v.
drop
Disposes of a value.
forgetNon-ferrocene_certified
Takes ownership and “forgets” about the value without running its destructor.
min_align_ofDeprecatedNon-ferrocene_certified
Returns the ABI-required minimum alignment of a type in bytes.
min_align_of_valDeprecatedNon-ferrocene_certified
Returns the ABI-required minimum alignment of the type of the value that val points to in bytes.
needs_dropNon-ferrocene_certified
Returns true if dropping values of type T matters.
replaceNon-ferrocene_certified
Moves src into the referenced dest, returning the previous dest value.
size_of
Returns the size of a type in bytes.
size_of_valNon-ferrocene_certified
Returns the size of the pointed-to value in bytes.
swapNon-ferrocene_certified
Swaps the values at two mutable locations, without deinitializing either one.
takeNon-ferrocene_certified
Replaces dest with the default value of T, returning the previous dest value.
transmute
Reinterprets the bits of a value of one type as another type.
transmute_copyNon-ferrocene_certified
Interprets src as having type &Dst, and then reads src without moving the contained value.
uninitializedDeprecatedNon-ferrocene_certified
Bypasses Rust’s normal memory-initialization checks by pretending to produce a value of type T, while doing nothing at all.
zeroedNon-ferrocene_certified
Returns the value of type T represented by the all-zero byte-pattern.
align_of_val_rawExperimentalNon-ferrocene_certified
Returns the ABI-required minimum alignment of the type of the value that val points to in bytes.
conjure_zstExperimentalNon-ferrocene_certified
Create a fresh instance of the inhabited ZST type T.
copyExperimentalNon-ferrocene_certified
Bitwise-copies a value.
forget_unsizedExperimentalNon-ferrocene_certified
Like forget, but also accepts unsized values.
size_of_val_rawExperimentalNon-ferrocene_certified
Returns the size of the pointed-to value in bytes.
variant_countExperimentalNon-ferrocene_certified
Returns the number of variants in the enum type T.

Unions§

MaybeUninitNon-ferrocene_certified
A wrapper type to construct uninitialized instances of T.