1 2 3 4 5 6 7 8 9 10 11 12 13
use crate::primitive::Primitive; pub trait Slice: Primitive { type Item; } impl<T> Primitive for [T] {} impl<T> Slice for [T] { type Item = T; } impl Primitive for str {} impl Slice for str { type Item = u8; }