File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -142,10 +142,14 @@ On `enum`s:
142
142
On ` struct ` s:
143
143
144
144
- ` repr ` - specifies the representation to use for this struct. Takes a list
145
- of options. The currently accepted ones are ` C ` and ` packed ` , which may be
146
- combined. ` C ` will use a C ABI compatible struct layout, and ` packed ` will
147
- remove any padding between fields (note that this is very fragile and may
148
- break platforms which require aligned access).
145
+ of options. The currently accepted ones are ` C ` , ` align ` and ` packed ` .
146
+ ` C ` will use a C ABI compatible struct layout. ` C ` can be used in conjunction
147
+ with ` align ` or ` packed ` . ` #[repr(align(x))] ` takes one argument which
148
+ increases alignment of the ` struct ` to the given value. The alignment must be
149
+ an unsigned power of two. ` packed ` will remove any padding between
150
+ fields (note that this is very fragile and may break platforms which require
151
+ aligned access). ` align ` and ` packed ` cannot be applied on the same struct,
152
+ and a ` packed ` struct cannot transitively contain another struct with ` align ` .
149
153
150
154
On ` union ` s:
151
155
@@ -416,4 +420,4 @@ You can implement `derive` for your own type through [procedural macros].
416
420
417
421
[ Doc comments ] : comments.html#doc-comments
418
422
[ The Rustdoc Book ] : ../rustdoc/the-doc-attribute.html
419
- [ procedural macros ] : procedural-macros.html
423
+ [ procedural macros ] : procedural-macros.html
You can’t perform that action at this time.
0 commit comments