blob!() { /* proc-macro */ }Expand description
blob!(<vis> static NAME, <path-expr>);
<path-expr> is forwarded verbatim to include_bytes!, so any expression
that the latter accepts works — a string literal, or e.g.
concat!(env!("OUT_DIR"), "/blob.bin") for a build-script-generated file.
Expands to:
ⓘ
#[used]
#[unsafe(link_section = ".lrodata.<lowercased name>")]
<vis> static NAME: [u8; const { include_bytes!("path/to/data").len() }]
= *include_bytes!("path/to/data");([u8; _] is not yet allowed in static item signatures on stable, so the
length is computed via a const block. include_bytes! is evaluated at
compile time and the resulting array is deduplicated, so the binary only
carries one copy of the data.)