ZeroablePrimitive

Trait ZeroablePrimitive 

Source
pub unsafe trait ZeroablePrimitive:
    Sized
    + Copy
    + Sealed { }
๐Ÿ”ฌThis is a nightly-only experimental API. (nonzero_internals)
Expand description

A marker trait for primitive types which can be zero.

This is an implementation detail for NonZero<T> which may disappear or be replaced at any time.

ยงSafety

Types implementing this trait must be primitives that are valid when zeroed.

The associated Self::NonZeroInner type must have the same size+align as Self, but with a niche and bit validity making it so the following transmutes are sound:

  • Self::NonZeroInner to Option<Self::NonZeroInner>
  • Option<Self::NonZeroInner> to Self

(And, consequently, Self::NonZeroInner to Self.)

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementorsยง

Morty Proxy This is a proxified and sanitized view of the page, visit original site.