| Crates.io | cluFullTransmute |
| lib.rs | cluFullTransmute |
| version | 1.4.1 |
| created_at | 2019-08-30 19:12:15.334215+00 |
| updated_at | 2025-08-01 22:36:54.806938+00 |
| description | Extended, no-constraint type transmutation API, featuring safe checks and const-ready logic. |
| homepage | |
| repository | https://github.com/clucompany/cluFullTransmute.git |
| max_upload_size | |
| id | 160984 |
| size | 50,268 |
[clufulltransmute]
( Extended, no-constraint type transmutation API, featuring safe checks and const-ready logic. )
Add this to your Cargo.toml:
[dependencies]
cluFullTransmute = "1.4.0"
and this to your source code:
use cluFullTransmute::try_transmute;
use cluFullTransmute::try_transmute_or_panic;
use cluFullTransmute::transmute_unchecked;
Purpose: Combines two arrays of the same size [T; N] into a single fixed-length array [T; N*2].
use cluFullTransmute::try_transmute_or_panic;
pub const fn concat_arrays<T, const N: usize, const NDOUBLE: usize>(
a: [T; N],
b: [T; N],
) -> [T; NDOUBLE] {
#[repr(C)]
struct Pair<T, const N: usize> {
a: [T; N],
b: [T; N],
}
unsafe { try_transmute_or_panic(Pair { a, b }) }
}
fn main() {
const A: [u8; 4] = [1, 2, 3, 4];
const B: [u8; 4] = [5, 6, 7, 8];
const C: [u8; 8] = concat_arrays(A, B);
println!("{C:?}"); // [1, 2, 3, 4, 5, 6, 7, 8]
}
See all
This project has a single license (LICENSE-APACHE-2.0).