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