148148//! fn new() -> impl PinInit<Self, Error> {
149149//! try_pin_init!(Self {
150150//! status <- CMutex::new(0),
151- //! buffer: Box::init(pin_init::zeroed ())?,
151+ //! buffer: Box::init(pin_init::init_zeroed ())?,
152152//! }? Error)
153153//! }
154154//! }
@@ -742,7 +742,7 @@ macro_rules! stack_try_pin_init {
742742/// - Fields that you want to initialize in-place have to use `<-` instead of `:`.
743743/// - In front of the initializer you can write `&this in` to have access to a [`NonNull<Self>`]
744744/// pointer named `this` inside of the initializer.
745- /// - Using struct update syntax one can place `..Zeroable::zeroed ()` at the very end of the
745+ /// - Using struct update syntax one can place `..Zeroable::init_zeroed ()` at the very end of the
746746/// struct, this initializes every field with 0 and then runs all initializers specified in the
747747/// body. This can only be done if [`Zeroable`] is implemented for the struct.
748748///
@@ -769,7 +769,7 @@ macro_rules! stack_try_pin_init {
769769/// });
770770/// let init = pin_init!(Buf {
771771/// buf: [1; 64],
772- /// ..Zeroable::zeroed ()
772+ /// ..Zeroable::init_zeroed ()
773773/// });
774774/// ```
775775///
@@ -805,7 +805,7 @@ macro_rules! pin_init {
805805/// ```rust
806806/// # #![feature(allocator_api)]
807807/// # #[path = "../examples/error.rs"] mod error; use error::Error;
808- /// use pin_init::{pin_data, try_pin_init, PinInit, InPlaceInit, zeroed };
808+ /// use pin_init::{pin_data, try_pin_init, PinInit, InPlaceInit, init_zeroed };
809809///
810810/// #[pin_data]
811811/// struct BigBuf {
@@ -817,7 +817,7 @@ macro_rules! pin_init {
817817/// impl BigBuf {
818818/// fn new() -> impl PinInit<Self, Error> {
819819/// try_pin_init!(Self {
820- /// big: Box::init(zeroed ())?,
820+ /// big: Box::init(init_zeroed ())?,
821821/// small: [0; 1024 * 1024],
822822/// ptr: core::ptr::null_mut(),
823823/// }? Error)
@@ -866,7 +866,7 @@ macro_rules! try_pin_init {
866866/// # #[path = "../examples/error.rs"] mod error; use error::Error;
867867/// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*;
868868/// # use pin_init::InPlaceInit;
869- /// use pin_init::{init, Init, zeroed };
869+ /// use pin_init::{init, Init, init_zeroed };
870870///
871871/// struct BigBuf {
872872/// small: [u8; 1024 * 1024],
@@ -875,7 +875,7 @@ macro_rules! try_pin_init {
875875/// impl BigBuf {
876876/// fn new() -> impl Init<Self> {
877877/// init!(Self {
878- /// small <- zeroed (),
878+ /// small <- init_zeroed (),
879879/// })
880880/// }
881881/// }
@@ -913,7 +913,7 @@ macro_rules! init {
913913/// # #![feature(allocator_api)]
914914/// # use core::alloc::AllocError;
915915/// # use pin_init::InPlaceInit;
916- /// use pin_init::{try_init, Init, zeroed };
916+ /// use pin_init::{try_init, Init, init_zeroed };
917917///
918918/// struct BigBuf {
919919/// big: Box<[u8; 1024 * 1024 * 1024]>,
@@ -923,7 +923,7 @@ macro_rules! init {
923923/// impl BigBuf {
924924/// fn new() -> impl Init<Self, AllocError> {
925925/// try_init!(Self {
926- /// big: Box::init(zeroed ())?,
926+ /// big: Box::init(init_zeroed ())?,
927927/// small: [0; 1024 * 1024],
928928/// }? AllocError)
929929/// }
@@ -1170,7 +1170,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
11701170 ///
11711171 /// ```rust
11721172 /// # #![expect(clippy::disallowed_names)]
1173- /// use pin_init::{init, zeroed , Init};
1173+ /// use pin_init::{init, init_zeroed , Init};
11741174 ///
11751175 /// struct Foo {
11761176 /// buf: [u8; 1_000_000],
@@ -1183,7 +1183,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
11831183 /// }
11841184 ///
11851185 /// let foo = init!(Foo {
1186- /// buf <- zeroed ()
1186+ /// buf <- init_zeroed ()
11871187 /// }).chain(|foo| {
11881188 /// foo.setup();
11891189 /// Ok(())
@@ -1508,11 +1508,11 @@ pub unsafe trait ZeroableOption {}
15081508// SAFETY: by the safety requirement of `ZeroableOption`, this is valid.
15091509unsafe impl < T : ZeroableOption > Zeroable for Option < T > { }
15101510
1511- /// Create a new zeroed T .
1511+ /// Create an initializer for a zeroed `T` .
15121512///
15131513/// The returned initializer will write `0x00` to every byte of the given `slot`.
15141514#[ inline]
1515- pub fn zeroed < T : Zeroable > ( ) -> impl Init < T > {
1515+ pub fn init_zeroed < T : Zeroable > ( ) -> impl Init < T > {
15161516 // SAFETY: Because `T: Zeroable`, all bytes zero is a valid bit pattern for `T`
15171517 // and because we write all zeroes, the memory is initialized.
15181518 unsafe {
0 commit comments