1 #![cfg_attr(feature = "used_linker", feature(used_with_arg))] 2 #![deny(warnings)] 3 #![allow(clippy::no_effect_underscore_binding)] 4 5 use linkme::distributed_slice; 6 7 pub struct Bencher; 8 9 #[distributed_slice] 10 pub static BENCHMARKS: [fn(&mut Bencher)] = [..]; 11 12 #[distributed_slice(BENCHMARKS)] 13 static BENCH_DESERIALIZE: fn(&mut Bencher) = bench_deserialize; 14 bench_deserialize(_b: &mut Bencher)15fn bench_deserialize(_b: &mut Bencher) { 16 /* ... */ 17 } 18 19 #[test] readme()20fn readme() { 21 // Iterate the elements. 22 for _bench in BENCHMARKS { /* ... */ } 23 24 // Index into the elements. 25 let _first = BENCHMARKS[0]; 26 27 // Slice the elements. 28 let _except_first = &BENCHMARKS[1..]; 29 30 // Invoke methods on the underlying slice. 31 let _len = BENCHMARKS.len(); 32 } 33