Skip to main content Module mem Copy item path Source type_info Experimental MVP for exposing compile-time information about types in a
runtime or const-eval processable way. offset_of Expands to the offset in bytes of a field from the beginning of the given type. Discriminant Opaque type representing the discriminant of an enum. ManuallyDrop A wrapper to inhibit the compiler from automatically calling T’s
destructor. This wrapper is 0-cost. Alignment Experimental A type storing a usize which is a power of two, and thus
represents a possible alignment in the Rust abstract machine. Assume Experimental Configurable proof assumptions of TransmuteFrom . DropGuard Experimental Wrap a value and run a closure when dropped. MaybeDangling Experimental Allows wrapped references and boxes to dangle. TransmuteFrom Experimental Marks that Src is transmutable into Self. 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 val points to in
bytes. 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 . min_align_of Deprecated Returns the ABI -required minimum alignment of a type in bytes. min_align_of_val Deprecated Returns the ABI -required minimum alignment of the type of the value that val points to in
bytes. needs_drop Returns true if dropping values of type T matters. replace Moves src into the referenced dest, returning the previous dest value. size_of Returns the size of a type in bytes. size_of_val Returns the size of the pointed-to value in bytes. swap Swaps the values at two mutable locations, without deinitializing either one. take Replaces dest with the default value of T, returning the previous dest value. transmute ⚠ Deprecated Reinterprets the bits of a value of one type as another type. transmute_copy ⚠ Interprets src as having type &Dst, and then reads src without moving
the contained value. uninitialized ⚠ Deprecated Bypasses Rust’s normal memory-initialization checks by pretending to
produce a value of type T, while doing nothing at all. zeroed ⚠ Returns the value of type T represented by the all-zero byte-pattern. align_of_val_raw ⚠ Experimental Returns the ABI -required minimum alignment of the type of the value that val points to in
bytes. conjure_zst ⚠ Experimental Create a fresh instance of the inhabited ZST type T. copy Experimental Bitwise-copies a value. forget_unsized Experimental Like forget , but also accepts unsized values. size_of_val_raw ⚠ Experimental Returns the size of the pointed-to value in bytes. transmute_neo ⚠ Experimental New version of transmute, exposed under this name so it can be iterated upon
without risking breakage to uses of “real” transmute. transmute_prefix ⚠ Experimental Like transmute , but only initializes the “common prefix” of the first
min(size_of::<Src>(), size_of::<Dst>()) bytes of the destination from the
corresponding bytes of the source. variant_count Experimental Returns the number of variants in the enum type T. MaybeUninit A wrapper type to construct uninitialized instances of T.