Trait IsSliceomorphic

Source
pub unsafe trait IsSliceomorphic: Sized {
    type Element;

    const LEN: usize;
}
Expand description

Marker trait used in bounds of Slice{Flat,Nest,Array}Ext.

This marks the array types approved for use with slice_of_array.

§Safety

For any implementation, Self must have the same size and alignment as [Self::Element; Self::LEN]. Furthermore, you must be comfortable with the possibility of [Self] being reinterpreted bitwise as [[Self::Element; Self::LEN]] (or vice versa) in any possible context.

§Notice

Please do NOT use this trait in public interfaces in your code.

slice_of_array is not yet 1.0, is not ready (or even designed) to be used as a public dependency.

However, feel free to implement this trait on your own private wrapper types around arrays and/or #[repr(C)] structs. (these use cases are explicitly supported because the author does it himself, and quite frankly, it’s pretty convenient!)

Required Associated Constants§

Required Associated Types§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, const N: usize> IsSliceomorphic for [T; N]

Source§

const LEN: usize = N

Source§

type Element = T

Implementors§