@@ -395,9 +395,10 @@ pub use ::pin_init_internal::pin_data;
395395/// ```
396396pub use :: pin_init_internal:: pinned_drop;
397397
398- /// Derives the [`Zeroable`] trait for the given struct.
398+ /// Derives the [`Zeroable`] trait for the given ` struct` or `union` .
399399///
400- /// This can only be used for structs where every field implements the [`Zeroable`] trait.
400+ /// This can only be used for `struct`s/`union`s where every field implements the [`Zeroable`]
401+ /// trait.
401402///
402403/// # Examples
403404///
@@ -406,14 +407,25 @@ pub use ::pin_init_internal::pinned_drop;
406407///
407408/// #[derive(Zeroable)]
408409/// pub struct DriverData {
409- /// id: i64,
410+ /// pub(crate) id: i64,
410411/// buf_ptr: *mut u8,
411412/// len: usize,
412413/// }
413414/// ```
415+ ///
416+ /// ```
417+ /// use pin_init::Zeroable;
418+ ///
419+ /// #[derive(Zeroable)]
420+ /// pub union SignCast {
421+ /// signed: i64,
422+ /// unsigned: u64,
423+ /// }
424+ /// ```
414425pub use :: pin_init_internal:: Zeroable ;
415426
416- /// Derives the [`Zeroable`] trait for the given struct if all fields implement [`Zeroable`].
427+ /// Derives the [`Zeroable`] trait for the given `struct` or `union` if all fields implement
428+ /// [`Zeroable`].
417429///
418430/// Contrary to the derive macro named [`macro@Zeroable`], this one silently fails when a field
419431/// doesn't implement [`Zeroable`].
@@ -426,15 +438,15 @@ pub use ::pin_init_internal::Zeroable;
426438/// // implmements `Zeroable`
427439/// #[derive(MaybeZeroable)]
428440/// pub struct DriverData {
429- /// id: i64,
441+ /// pub(crate) id: i64,
430442/// buf_ptr: *mut u8,
431443/// len: usize,
432444/// }
433445///
434446/// // does not implmement `Zeroable`
435447/// #[derive(MaybeZeroable)]
436448/// pub struct DriverData2 {
437- /// id: i64,
449+ /// pub(crate) id: i64,
438450/// buf_ptr: *mut u8,
439451/// len: usize,
440452/// // this field doesn't implement `Zeroable`
@@ -1580,7 +1592,7 @@ impl_tuple_zeroable!(A, B, C, D, E, F, G, H, I, J);
15801592/// });
15811593/// ```
15821594pub trait Wrapper < T > {
1583- /// Create an pin-initializer for a [`Self`] containing `T` form the `value_init` initializer.
1595+ /// Creates an pin-initializer for a [`Self`] containing `T` from the `value_init` initializer.
15841596 fn pin_init < E > ( value_init : impl PinInit < T , E > ) -> impl PinInit < Self , E > ;
15851597}
15861598
0 commit comments