3 use std::marker::PhantomData;
8 fn apply_all<F>(&self, f: F)
10 F: FamilyItemFn<Self> { }
13 struct Array<T>(PhantomData<T>);
15 impl<T: 'static> Family for Array<T> {
16 type Item<'a> = &'a T;
19 trait FamilyItemFn<T: Family> {
20 fn apply(&self, item: T::Item<'_>);
23 impl<T, F> FamilyItemFn<T> for F
26 for<'a> F: Fn(T::Item<'a>)
28 fn apply(&self, item: T::Item<'_>) {
33 fn process<T: 'static>(array: Array<T>) {
35 array.apply_all(|x: &T| { });
38 array.apply_all(|x: <Array<T> as Family>::Item<'_>| { });