Skip to content

Commit 2c3df3e

Browse files
authored
cpubits: add expression example (#1422)
1 parent 532f78a commit 2c3df3e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cpubits/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@
7979
/// }
8080
/// ```
8181
///
82+
/// ## Use as an expression
83+
///
84+
/// It's also possible to use the macro as an expression, although in somewhat limited contexts
85+
/// due to its attribute handling:
86+
///
87+
/// ```
88+
/// fn detected_cpubits() -> u32 {
89+
/// cpubits::cpubits! {
90+
/// 16 => { 16 }
91+
/// 32 => { 32 }
92+
/// 64 => { 64 }
93+
/// }
94+
/// }
95+
/// ```
96+
///
8297
/// # Selection rules
8398
///
8499
/// The macro augments `target_pointer_width`-based selection with specific overrides which promote

0 commit comments

Comments
 (0)