1 //! Generates large snippets of Rust code for usage in the benchmarks.
7 use crate::project_root;
9 pub fn big_struct() -> String {
12 let mut buf = "pub struct RegisterBlock {".to_string();
14 format_to!(buf, " /// Doc comment for {}.\n", i);
15 format_to!(buf, " pub s{}: S{},\n", i, i);
17 buf.push_str("}\n\n");
34 pub fn glorious_old_parser() -> String {
35 let path = project_root().join("bench_data/glorious_old_parser");
36 fs::read_to_string(&path).unwrap()
39 pub fn numerous_macro_rules() -> String {
40 let path = project_root().join("bench_data/numerous_macro_rules");
41 fs::read_to_string(&path).unwrap()