Closed
Description
Currently ZeroCopyFrom
has the following signature:
pub trait ZeroCopyFrom<C: ?Sized>: for<'a> Yokeable<'a> {
fn zero_copy_from<'b>(cart: &'b C) -> <Self as Yokeable<'b>>::Output;
}
impl<'data> ZeroCopyFrom<Foo<'data>> for Foo<'static> { .. }
It's supposed to be implemented on 'static
types.
For its original purpose of helping attach_to_foo_cart()
functions, it makes a lot of sense (this is why it derives from Yokeable
) but there are a couple problems:
- Since the
'static
type doesn't show up in a lot of places, you really need to use a lot of explicit typing and UFCS to make stuff compile - Stuff like Should we have FromVarULE? #1180 can't use it
It might be better to do this instead:
pub trait ZeroCopyFrom<'data, C: ?Sized> {
fn zero_copy_from<'data>(cart: &'data C) -> Self;
}
impl<'a, 'b: 'a> ZeroCopyFrom<'b, Foo<'b>> for Foo<'a> { .. }
If we can make this work with all of the signatures in use. There may be some need of for<'b> ZCF<'b>
.
Discussed a bit with @sffc , I plan to investigate this