Apply suggestions from code review

Co-Authored-By: Ralf Jung <post@ralfj.de>
This commit is contained in:
Christopher Durham
2020-04-16 16:44:30 -04:00
committed by GitHub
parent 053c2dddda
commit 5f1fd9da54
+3 -1
View File
@@ -274,7 +274,8 @@ pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> {
///
/// # Examples
///
/// To calculate the layout of a `#[repr(C)]` structure from its fields' layouts:
/// To calculate the layout of a `#[repr(C)]` structure and the offsets of
/// the fields from its fields' layouts:
///
/// ```rust
/// # use std::alloc::{Layout, LayoutErr};
@@ -286,6 +287,7 @@ pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> {
/// layout = new_layout;
/// offsets.push(offset);
/// }
/// // Remember to finalize with `pad_to_align`!
/// Ok((layout.pad_to_align(), offsets))
/// }
/// # // test that it works