arrayref::array_ref! [] [src]

macro_rules! array_ref {
    ($arr:expr, $offset:expr, $len:expr) => {{
        {
            #[inline]
            unsafe fn as_array<T>(slice: &[T]) -> &[T; $len] {
                &*(slice.as_ptr() as *const [_; $len])
            }
            let slice = & $arr[$offset..$offset+$len];
            unsafe {
                as_array(slice)
            }
        }
    }}
}

You can use array_ref to generate an array reference to a subset of a sliceable bit of data (which could be an array, or a slice, or a Vec).