Crates.io | build_script_file_gen |
lib.rs | build_script_file_gen |
version | 0.6.1 |
source | src |
created_at | 2017-11-10 08:11:07.587973 |
updated_at | 2017-11-15 19:23:51.559304 |
description | A Rust library which contains convenience methods to generate files with specified content via build scripts and include their content within source files. |
homepage | https://github.com/harindaka/build_script_file_gen |
repository | https://github.com/harindaka/build_script_file_gen |
max_upload_size | |
id | 38812 |
size | 8,257 |
A Rust library which encapsulates convenience methods to generate files via build scripts and include their content within source files during build time.
extern crate build_script_file_gen;
use build_script_file_gen::gen_file_str;
fn main() {
let string_content = "Hello World!";
gen_file_str("hello.txt", &string_content);
//or
let rust_code = r#"println!("Hello World!");"#;
gen_file_str("hello.rs", &rust_code);
}
#[macro_use]
extern crate build_script_file_gen;
fn main() {
//hello.txt contains the text: Hello World!;
//which will make this function print Hello World! when compiled
println!(include_file_str!("hello.txt"));
//or
//hello.rs contains the text: println!("Hello World!");
//which will make this function print Hello World! when compiled
include_file!("hello.rs");
}