[][src]Module with_builtin_macros::builtin_macros::include_str_from_root

See the stdlib documentation.

The difference between ::core::include_str! and this version of the macro is that, due to limitations of proc-macros in stable Rust, it is not possible to know whence a macro is called.

Thus, this macro requires it be called with a path that starts from the "root" of the package, i.e., a path that will be interpreted as if it started from: concat!(env!("CARGO_MANIFEST_DIR"), "/").

Example

This example is not tested
use ::with_builtin_macros::with_builtin;

const HEX_ARRAY: &[u8] = {
    with_builtin!(let $hex_string = include_str_from_root!("path/to/hex/file") in {
        ::hex_literal::hex!($hex_string)
    })
};