array_to_core

Function array_to_core 

Source
pub fn array_to_core<T, const N: usize>(
    array: Array<T, <[T; N] as AssocArraySize>::Size>,
) -> [T; N]
Expand description

Convert an Array into a core array.

This is mostly equivalent to array.0, but it also infers the size of the Array from the returned core array, if possible.

ยงExample

use hybrid_array::Array;
use array_fusion::array_to_core;

let data = [0, 42, 0x0, 0x0, 0x12, 0x34];
// Notice that the size is inferred due to the use of `array_to_core` below
let hybird: Array<u8, _> = Array(data);

// Allows to infer the size of `hybird` based on the type of `core`
let core: [u8; 6] = array_to_core(hybird);

assert_eq!(core, data);