Crates.io | include_bytes_aligned |
lib.rs | include_bytes_aligned |
version | 0.1.4 |
source | src |
created_at | 2021-07-15 16:52:17.786958 |
updated_at | 2024-08-21 10:47:35.179045 |
description | A simple macro that embeds the bytes of an external file into the executable and guarantees that they are aligned. |
homepage | https://github.com/PonasKovas/include_bytes_aligned |
repository | https://github.com/PonasKovas/include_bytes_aligned |
max_upload_size | |
id | 423157 |
size | 4,127 |
A simple macro that embeds the bytes of an external file into the executable and guarantees that they are aligned.
include_bytes_aligned!(ALIGNMENT, PATH)
Where ALIGNMENT
is any integer literal (must be a power of 2), and PATH is a string literal path
to the file to include, just as in include_bytes!
.
use include_bytes_aligned::include_bytes_aligned;
// Aligns the data to 16 bytes
static DATA: &'static [u8] = include_bytes_aligned!(16, "path/to/file.txt");
This macro does not copy the bytes or duplicate them. Takes up the same amount of space in memory
as the usual include_bytes!
.