Skip to content

Commit

Permalink
Add complete doc example for include_bytes!.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Aug 12, 2017
1 parent ea6f0f0 commit 446ff0d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/libstd/macros.rs
Expand Up @@ -478,9 +478,26 @@ pub mod builtin {
///
/// # Examples
///
/// Assume there are two files in the same directory with the following
/// contents:
///
/// File 'spanish.in':
///
/// ```text
/// adiós
/// ```
///
/// File 'main.rs':
///
/// ```ignore (cannot-doctest-external-file-dependency)
/// let secret_key = include_bytes!("secret-key.bin");
/// fn main() {
/// let bytes = include_bytes!("spanish.in");
/// assert_eq!(bytes, b"adi\xc3\xb3s\n");
/// print!("{}", String::from_utf8_lossy(bytes));
/// }
/// ```
///
/// Compiling 'main.rs' and running the resulting binary will print "adiós".
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
macro_rules! include_bytes { ($file:expr) => ({ /* compiler built-in */ }) }
Expand Down

0 comments on commit 446ff0d

Please sign in to comment.