1 The `DispatchFromDyn` trait currently can only be implemented for
2 builtin pointer types and structs that are newtype wrappers around them
3 — that is, the struct must have only one field (except for`PhantomData`),
4 and that field must itself implement `DispatchFromDyn`.
9 #![feature(dispatch_from_dyn, unsize)]
15 struct Ptr<T: ?Sized>(*const T);
17 impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Ptr<U>> for Ptr<T>
24 #![feature(dispatch_from_dyn)]
32 _phantom: PhantomData<()>,
35 impl<T, U> DispatchFromDyn<Wrapper<U>> for Wrapper<T>
37 T: DispatchFromDyn<U>,
41 Example of illegal `DispatchFromDyn` implementation
42 (illegal because of extra field)
45 #![feature(dispatch_from_dyn)]
46 use std::ops::DispatchFromDyn;
48 struct WrapperExtraField<T> {
53 impl<T, U> DispatchFromDyn<WrapperExtraField<U>> for WrapperExtraField<T>
55 T: DispatchFromDyn<U>,