We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 053c2dd commit 5f1fd9dCopy full SHA for 5f1fd9d
src/libcore/alloc/layout.rs
@@ -274,7 +274,8 @@ impl Layout {
274
///
275
/// # Examples
276
277
- /// 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
278
+ /// the fields from its fields' layouts:
279
280
/// ```rust
281
/// # use std::alloc::{Layout, LayoutErr};
@@ -286,6 +287,7 @@ impl Layout {
286
287
/// layout = new_layout;
288
/// offsets.push(offset);
289
/// }
290
+ /// // Remember to finalize with `pad_to_align`!
291
/// Ok((layout.pad_to_align(), offsets))
292
293
/// # // test that it works
0 commit comments