Trait slice_of_array::IsSliceomorphic
[−]
[src]
pub unsafe trait IsSliceomorphic: Sized { type Element; fn array_len() -> usize; }
Marker trait used in bounds of Slice{Flat,Nest,Array}Ext
.
This marks the array types approved for use with slice_of_array
.
It is deliberately not implemented for arrays of size 0,
because said traits are otherwise perfect isomorphisms for
the inputs that they don't fail on;
Having .flat().nest()
turn a &[[i32; 0]]
of length 18
into a &[[i32; 0]]
of length 0 gives me the heebie jeebies.
Safety
Unsafe code relies on a number of properties of arrays for any type that implements this trait. These properties are left unspecified and may change on a whim.
Notice
Please do NOT use this trait as a generic bound in your code.
In fact, I would rather you copied and pasted it into your own code.