# Function ethcore_util::standard::mem::zeroed 1.0.0 [−] [src]

    pub unsafe fn zeroed<T>() -> T

Creates a value whose bytes are all zero.

This has the same effect as allocating space with `mem::uninitialized` and then zeroing it out. It is useful for FFI sometimes, but should generally be avoided.

There is no guarantee that an all-zero byte-pattern represents a valid value of some type `T`. If `T` has a destructor and the value is destroyed (due to a panic or the end of a scope) before being initialized, then the destructor will run on zeroed data, likely leading to undefined behavior.

See also the documentation for `mem::uninitialized`, which has many of the same caveats.

# Examples

    use std::mem;

    let x: i32 = unsafe { mem::zeroed() };
    assert_eq!(0, x);

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)