core: add {Imm,M}utablePrimitiveSlice trait

Lets eligible slices be converted to a slice of bytes. Abstracts out some
sensible unsafe behavior from `rust-image`.