diff options
| author | bors <bors@rust-lang.org> | 2015-08-28 13:48:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-08-28 13:48:09 +0000 |
| commit | ab792abf1fcc28afbd315426213f6428da25c085 (patch) | |
| tree | d1e8f5e5dfb912a1fd2fdb883812fe47ce897429 /src/libstd/macros.rs | |
| parent | 6f28232756a6842acb1d2da6defdea43cfe95dde (diff) | |
| parent | d9819b76d258a17a70b4e58331bd4e58cfcc5a55 (diff) | |
| download | rust-ab792abf1fcc28afbd315426213f6428da25c085.tar.gz rust-ab792abf1fcc28afbd315426213f6428da25c085.zip | |
Auto merge of #28047 - steveklabnik:doc_print, r=alexcrichton
Diffstat (limited to 'src/libstd/macros.rs')
| -rw-r--r-- | src/libstd/macros.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 317130f5f0e..e4866982176 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -67,6 +67,26 @@ macro_rules! panic { /// Note that stdout is frequently line-buffered by default so it may be /// necessary to use `io::stdout().flush()` to ensure the output is emitted /// immediately. +/// +/// # Examples +/// +/// ``` +/// use std::io::{self, Write}; +/// +/// print!("this "); +/// print!("will "); +/// print!("be "); +/// print!("on "); +/// print!("the "); +/// print!("same "); +/// print!("line "); +/// +/// io::stdout().flush().unwrap(); +/// +/// print!("this string has a newline, why not choose println! instead?\n"); +/// +/// io::stdout().flush().unwrap(); +/// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] #[allow_internal_unstable] |
