macro_rules! build_rs_lookup_table_file_generation {
(fn $function_name:ident, $checksum_function:ident, $lookup_table_constant_name:ident, $lookup_table_file:expr, $t:ty, $size:expr) => { ... };
}
Expand description
Code generation macro for use in build.rs
files.
Generate file containing a lookup table constant with all the values for the checksum function.
Example build.rs
file:
use embedded_crc_macros::{crc8, build_rs_lookup_table_file_generation};
crc8!(fn smbus_pec, 7, 0, "");
build_rs_lookup_table_file_generation!(fn write_file, smbus_pec, LOOKUP_TABLE, "lookup_table.rs", u8, 256);
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=lib.rs");
write_file().expect("Couldn't write lookup table file!");
}