zeroed in pin_init - Rust
Skip to main content zeroed pin_init Function zeroed Source pub const fn zeroed<T: Zeroable >() -> T Expand description Create a T consisting of all zeroes. Whenever a type implements Zeroable , this function should be preferred over core::mem::zeroed() or using MaybeUninit<T>::zeroed().assume_init() . While const traits remain unstable, this function serves as the const version of Zeroable::zeroed() . § Examples use pin_init::{Zeroable, zeroed}; #[derive(Zeroable)] struct Point { x: u32, y: u32, } let point: Point = zeroed(); assert_eq! (point.x, 0 ); assert_eq! (point.y, 0 );