Zeroable

Trait Zeroable 

Source
pub unsafe trait Zeroable: Sized {
    // Provided method
    fn zeroed() -> Self { ... }
}
Expand description

Trait for types that can be safely created with zeroed.

An all-zeroes value may or may not be the same value as the Default value of the type.

§Safety

  • Your type must be inhabited (eg: no Infallible).
  • Your type must be allowed to be an “all zeroes” bit pattern (eg: no NonNull<T>).

§Features

Some impls are feature gated due to the MSRV policy:

  • MaybeUninit<T> was not available in 1.34.0, but is available under the zeroable_maybe_uninit feature flag.
  • Atomic* types require Rust 1.60.0 or later to work on certain platforms, but is available under the zeroable_atomics feature flag.
  • [T; N] for arbitrary N requires the min_const_generics feature flag.

Provided Methods§

Source

fn zeroed() -> Self

Calls zeroed.

This is a trait method so that you can write MyType::zeroed() in your code. It is a contract of this trait that if you implement it on your type you must not override this method.

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.

Implementations on Foreign Types§

Source§

impl Zeroable for bool

Source§

impl Zeroable for char

Source§

impl Zeroable for f32

Source§

impl Zeroable for f64

Source§

impl Zeroable for i8

Source§

impl Zeroable for i16

Source§

impl Zeroable for i32

Source§

impl Zeroable for i64

Source§

impl Zeroable for i128

Source§

impl Zeroable for isize

Source§

impl Zeroable for *const str

Source§

impl Zeroable for *mut str

Source§

impl Zeroable for u8

Source§

impl Zeroable for u16

Source§

impl Zeroable for u32

Source§

impl Zeroable for u64

Source§

impl Zeroable for u128

Source§

impl Zeroable for ()

Source§

impl Zeroable for usize

Source§

impl Zeroable for __m128

Available on x86-64 only.
Source§

impl Zeroable for __m128d

Available on x86-64 only.
Source§

impl Zeroable for __m128i

Available on x86-64 only.
Source§

impl Zeroable for __m256

Available on x86-64 only.
Source§

impl Zeroable for __m256d

Available on x86-64 only.
Source§

impl Zeroable for __m256i

Available on x86-64 only.
Source§

impl Zeroable for PhantomPinned

Source§

impl Zeroable for PremultipliedColorU8

Source§

impl<A> Zeroable for (A,)
where A: Zeroable,

Source§

impl<A, B> Zeroable for (A, B)
where A: Zeroable, B: Zeroable,

Source§

impl<A, B, C> Zeroable for (A, B, C)
where A: Zeroable, B: Zeroable, C: Zeroable,

Source§

impl<A, B, C, D> Zeroable for (A, B, C, D)
where A: Zeroable, B: Zeroable, C: Zeroable, D: Zeroable,

Source§

impl<A, B, C, D, E> Zeroable for (A, B, C, D, E)
where A: Zeroable, B: Zeroable, C: Zeroable, D: Zeroable, E: Zeroable,

Source§

impl<A, B, C, D, E, F> Zeroable for (A, B, C, D, E, F)
where A: Zeroable, B: Zeroable, C: Zeroable, D: Zeroable, E: Zeroable, F: Zeroable,

Source§

impl<A, B, C, D, E, F, G> Zeroable for (A, B, C, D, E, F, G)
where A: Zeroable, B: Zeroable, C: Zeroable, D: Zeroable, E: Zeroable, F: Zeroable, G: Zeroable,

Source§

impl<A, B, C, D, E, F, G, H> Zeroable for (A, B, C, D, E, F, G, H)
where A: Zeroable, B: Zeroable, C: Zeroable, D: Zeroable, E: Zeroable, F: Zeroable, G: Zeroable, H: Zeroable,

Source§

impl<T> Zeroable for Option<T>

Source§

impl<T> Zeroable for *const [T]

Source§

impl<T> Zeroable for *const T

Source§

impl<T> Zeroable for *mut [T]

Source§

impl<T> Zeroable for *mut T

Source§

impl<T> Zeroable for Cell<T>
where T: Zeroable,

Source§

impl<T> Zeroable for UnsafeCell<T>
where T: Zeroable,

Source§

impl<T> Zeroable for Reverse<T>
where T: Zeroable,

Source§

impl<T> Zeroable for PhantomData<T>
where T: ?Sized,

Source§

impl<T> Zeroable for ManuallyDrop<T>
where T: Zeroable,

Source§

impl<T> Zeroable for Wrapping<T>
where T: Zeroable,

Source§

impl<T, const N: usize> Zeroable for [T; N]
where T: Zeroable,

Available on crate feature min_const_generics only.

Implementors§

Source§

impl Zeroable for InstanceRaw

Source§

impl Zeroable for Vertex

Source§

impl Zeroable for Affine2

Source§

impl Zeroable for Affine3A

Source§

impl Zeroable for DAffine2

Source§

impl Zeroable for DAffine3

Source§

impl Zeroable for DMat2

Source§

impl Zeroable for DMat3

Source§

impl Zeroable for DMat4

Source§

impl Zeroable for DQuat

Source§

impl Zeroable for DVec2

Source§

impl Zeroable for DVec3

Source§

impl Zeroable for DVec4

Source§

impl Zeroable for I8Vec2

Source§

impl Zeroable for I8Vec3

Source§

impl Zeroable for I8Vec4

Source§

impl Zeroable for I16Vec2

Source§

impl Zeroable for I16Vec3

Source§

impl Zeroable for I16Vec4

Source§

impl Zeroable for I64Vec2

Source§

impl Zeroable for I64Vec3

Source§

impl Zeroable for I64Vec4

Source§

impl Zeroable for IVec2

Source§

impl Zeroable for IVec3

Source§

impl Zeroable for IVec4

Source§

impl Zeroable for Mat2

Source§

impl Zeroable for Mat3

Source§

impl Zeroable for Mat3A

Source§

impl Zeroable for Mat4

Source§

impl Zeroable for Quat

Source§

impl Zeroable for U8Vec2

Source§

impl Zeroable for U8Vec3

Source§

impl Zeroable for U8Vec4

Source§

impl Zeroable for U16Vec2

Source§

impl Zeroable for U16Vec3

Source§

impl Zeroable for U16Vec4

Source§

impl Zeroable for U64Vec2

Source§

impl Zeroable for U64Vec3

Source§

impl Zeroable for U64Vec4

Source§

impl Zeroable for USizeVec2

Source§

impl Zeroable for USizeVec3

Source§

impl Zeroable for USizeVec4

Source§

impl Zeroable for UVec2

Source§

impl Zeroable for UVec3

Source§

impl Zeroable for UVec4

Source§

impl Zeroable for Vec2

Source§

impl Zeroable for Vec3

Source§

impl Zeroable for Vec3A

Source§

impl Zeroable for Vec4

Source§

impl Zeroable for ExternalTextureTransferFunction

Source§

impl Zeroable for DispatchIndirectArgs

Source§

impl Zeroable for DrawIndexedIndirectArgs

Source§

impl Zeroable for DrawIndirectArgs

Source§

impl Zeroable for ExternalTextureParams