Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 363 Bytes

include_str!.md

File metadata and controls

20 lines (15 loc) · 363 Bytes

include_str!

If you want to include a static utf-8 file in your Rust binary, you can simply use the include_str! macro:

# hello.txt
hello world!
const CONTENTS: &str = include_str!("hello.txt");

fn main() {
    println!("{}", CONTENTS);
    // prints "hello world!"
}

docs