mirror of
https://gitee.com/openharmony/third_party_rust_bitflags
synced 2024-11-23 07:10:11 +00:00
example_generated: add an example for docs
This commit is contained in:
parent
b6846482ff
commit
c3b95543d1
14
src/example_generated.rs
Normal file
14
src/example_generated.rs
Normal file
@ -0,0 +1,14 @@
|
||||
//! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS
|
||||
//! CRATE**.
|
||||
|
||||
bitflags! {
|
||||
/// This is the same `Flags` struct defined in the [crate level example](../index.html#example).
|
||||
pub struct Flags: u32 {
|
||||
const FLAG_A = 0b00000001;
|
||||
const FLAG_B = 0b00000010;
|
||||
const FLAG_C = 0b00000100;
|
||||
const FLAG_ABC = FLAG_A.bits
|
||||
| FLAG_B.bits
|
||||
| FLAG_C.bits;
|
||||
}
|
||||
}
|
@ -564,6 +564,8 @@ macro_rules! __impl_bitflags {
|
||||
};
|
||||
}
|
||||
|
||||
pub mod example_generated;
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(non_upper_case_globals, dead_code)]
|
||||
mod tests {
|
||||
|
Loading…
Reference in New Issue
Block a user