https://doc.rust-lang.org/reference/type-coercions.html#unsized-coercions
Additionally, a type Foo<T>
can implement CoerceUnsized<Foo<U>>
when T
implements Unsize<U>
or CoerceUnsized<Foo<U>>
. This allows it to provide a unsized coercion to Foo<U>
.
However, the document of CoerceUnsized
regarding the corresponding case says:
you can directly implement CoerceUnsized<Wrap<U>>
for Wrap<T>
where T: CoerceUnsized<U>