example_generated: add an example for docs

This commit is contained in:
Joonas Koivunen 2017-04-04 13:57:10 +03:00
parent b6846482ff
commit c3b95543d1
2 changed files with 16 additions and 0 deletions

14
src/example_generated.rs Normal file
View 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;
}
}

View File

@ -564,6 +564,8 @@ macro_rules! __impl_bitflags {
};
}
pub mod example_generated;
#[cfg(test)]
#[allow(non_upper_case_globals, dead_code)]
mod tests {