devela::_dep::bytemuck

Trait Zeroable

pub unsafe trait Zeroable: Sized {
    // Provided method
    fn zeroed() -> Self { ... }
}
Available on crate feature dep_bytemuck only.
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§

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§

§

impl Zeroable for bool

§

impl Zeroable for char

§

impl Zeroable for f16

§

impl Zeroable for f32

§

impl Zeroable for f64

§

impl Zeroable for f128

§

impl Zeroable for i8

§

impl Zeroable for i16

§

impl Zeroable for i32

§

impl Zeroable for i64

§

impl Zeroable for i128

§

impl Zeroable for isize

§

impl Zeroable for *const str

§

impl Zeroable for *mut str

§

impl Zeroable for u8

§

impl Zeroable for u16

§

impl Zeroable for u32

§

impl Zeroable for u64

§

impl Zeroable for u128

§

impl Zeroable for ()

§

impl Zeroable for usize

§

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

§

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

§

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

§

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

§

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

§

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,

§

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,

§

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,

§

impl<T> Zeroable for *const [T]

§

impl<T> Zeroable for *const T

§

impl<T> Zeroable for *mut [T]

§

impl<T> Zeroable for *mut T

§

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

Implementors§

§

impl Zeroable for __m128

§

impl Zeroable for __m128d

§

impl Zeroable for __m128i

§

impl Zeroable for __m256

§

impl Zeroable for __m256d

§

impl Zeroable for __m256i

§

impl Zeroable for AtomicBool

§

impl Zeroable for AtomicI8

§

impl Zeroable for AtomicI16

§

impl Zeroable for AtomicI32

§

impl Zeroable for AtomicI64

§

impl Zeroable for AtomicIsize

§

impl Zeroable for AtomicU8

§

impl Zeroable for AtomicU16

§

impl Zeroable for AtomicU32

§

impl Zeroable for AtomicU64

§

impl Zeroable for AtomicUsize

§

impl Zeroable for PhantomPinned

§

impl Zeroable for m128

§

impl Zeroable for m128d

§

impl Zeroable for m128i

§

impl Zeroable for m256

§

impl Zeroable for m256d

§

impl Zeroable for m256i

§

impl Zeroable for f32x4

§

impl Zeroable for f32x8

§

impl Zeroable for f64x2

§

impl Zeroable for f64x4

§

impl Zeroable for i8x16

§

impl Zeroable for i8x32

§

impl Zeroable for i16x8

§

impl Zeroable for i16x16

§

impl Zeroable for i32x4

§

impl Zeroable for i32x8

§

impl Zeroable for i64x2

§

impl Zeroable for i64x4

§

impl Zeroable for u8x16

§

impl Zeroable for u16x8

§

impl Zeroable for u16x16

§

impl Zeroable for u32x4

§

impl Zeroable for u32x8

§

impl Zeroable for u64x2

§

impl Zeroable for u64x4

§

impl<T> Zeroable for Option<T>

§

impl<T> Zeroable for AtomicPtr<T>

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<T> Zeroable for MaybeUninit<T>