macro_rules! include_bytes_aligned {
($path:expr) => { ... };
}Expand description
Includes a file’s bytes as a 16-byte-aligned &'static [u8].
include_bytes! yields a [u8; N], whose alignment guarantee is 1. The
connection cost matrix payload starts at byte 6 of matrix.mtx, so a
1-aligned base can leave it at an odd address, which pushes
crate::dictionary::connection_cost_matrix::ConnectionCostMatrix::load
into its owning fallback and reintroduces exactly the copy that this crate
avoids elsewhere (71.5 MB for UniDic). Wrapping the array in a
#[repr(C, align(16))] struct raises the static’s alignment so the
zero-copy path is taken deterministically rather than by the linker’s
goodwill.
Like [embedded_dictionary!], the data is bound to a static rather than
a const so it is not copied into the crate’s metadata.
§Arguments
$path- Path forwarded toinclude_bytes!.
§Returns
A &'static [u8] whose first byte is 16-byte aligned.