| Crates.io | static-include-bytes |
| lib.rs | static-include-bytes |
| version | 2.0.0 |
| created_at | 2023-08-19 00:29:52.087405+00 |
| updated_at | 2023-08-20 19:28:06.594029+00 |
| description | Like the built-in `include_bytes!` macro but produces a static array definition. |
| homepage | |
| repository | https://github.com/summivox/static-include-bytes-rs |
| max_upload_size | |
| id | 948426 |
| size | 5,668 |
static_include_bytes! MacroLike the built-in include_bytes! macro, but produces a static array definition.
use static_include_bytes::static_include_bytes;
static_include_bytes!(#[no_mangle] TEN_BYTES = concat!(env!("CARGO_MANIFEST_DIR"), "/ten_bytes.bin"));
assert_eq!(TEN_BYTES.len(), 10);
assert_eq!(&TEN_BYTES, b"0123456789");
The macro invocation is equivalent to static TEN_BYTES: [u8; _] = include_bytes!(...);, but as of 2023-08-18, you cannot write this directly due to https://github.com/rust-lang/rust/issues/85077 .