Macro include_bytes_plus::include_bytes
source · [−]include_bytes!() { /* proc-macro */ }Expand description
Includes a file as a reference to a byte array.
This macro will yield an expression of type [u8; N] by default with content of file.
To reinterpret it as different type add as <type> where type can be: u8, u16, u32, u64 or u128.
NOTE:
Due to Span::source_file being unstable, the file is searched relative to crate root.
Usage:
use include_bytes_plus::include_bytes;
let bytes = include_bytes!("tests/include.in");
let bytes_u16 = include_bytes!("tests/include.in" as u16);
let bytes_u16_2 = include_bytes!("tests/include with whitespaces.in" as u16);
assert_eq!(bytes.len(), bytes_u16.len() * 2);
assert_eq!(bytes.len(), bytes_u16_2.len() * 2);