mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-23 02:27:39 +03:00
Apply suggestions from code review
Co-Authored-By: Ralf Jung <post@ralfj.de>
This commit is contained in:
committed by
GitHub
parent
053c2dddda
commit
5f1fd9da54
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user