include_nasm_bin!() { /* proc-macro */ }
Expand description

Assembles a file with NASM into raw binary and includes the output as a reference to a byte array.

The file is located relative to the current file (similarly to how modules are found). This macro will yield an expression of type &'static [u8; N] which is the contents of the assembled file.


This macro requires NASM to be installed.


Assume there is a file ‘boot.asm’ in the same directory as ‘’.

let boot_code = include_nasm_bin!("boot.asm");

This code is equivalent to running nasm -f bin boot.asm -o boot and including boot via include_bytes!.