Demonstrate include!
with Rust code, not just a string slice literal.
This commit is contained in:
parent
8da3ff3fcc
commit
ea6f0f060c
@ -545,23 +545,28 @@ macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
|
||||
/// Assume there are two files in the same directory with the following
|
||||
/// contents:
|
||||
///
|
||||
/// File 'my_str.in':
|
||||
/// File 'monkeys.in':
|
||||
///
|
||||
/// ```ignore (only-for-syntax-highlight)
|
||||
/// "Hello World!"
|
||||
/// ['🙈', '🙊', '🙉']
|
||||
/// .iter()
|
||||
/// .cycle()
|
||||
/// .take(6)
|
||||
/// .collect::<String>()
|
||||
/// ```
|
||||
///
|
||||
/// File 'main.rs':
|
||||
///
|
||||
/// ```ignore (cannot-doctest-external-file-dependency)
|
||||
/// fn main() {
|
||||
/// let my_str = include!("my_str.in");
|
||||
/// println!("{}", my_str);
|
||||
/// let my_string = include!("monkeys.in");
|
||||
/// assert_eq!("🙈🙊🙉🙈🙊🙉", my_string);
|
||||
/// println!("{}", my_string);
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// Compiling 'main.rs' and running the resulting binary will print "Hello
|
||||
/// World!".
|
||||
/// Compiling 'main.rs' and running the resulting binary will print
|
||||
/// "🙈🙊🙉🙈🙊🙉".
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[macro_export]
|
||||
macro_rules! include { ($file:expr) => ({ /* compiler built-in */ }) }
|
||||
|
Loading…
Reference in New Issue
Block a user