pub unsafe trait Outlive<'js> {
type Target<'to>;
}
Expand description
The trait to help break lifetime rules when JS objects leaves current context via Persistent
wrapper.
§Safety
Outlive<'js>
must be implemented for types the same, specific, lifetime ’js.
For example the following is unsound:
struct Container<'js>(rquickjs::Object<'js>);
unsafe impl<'a,'js> Outlive<'js> for Container<'a>{
type Target<'to> = Container<'to>;
}
Instead it must be implemented as following
struct Container<'js>(rquickjs::Object<'js>);
unsafe impl<'js> Outlive<'js> for Container<'js>{
type Target<'to> = Container<'to>;
}
Outlive::Target
must be the same type with all ’js lifetimes changed from ’js to ’to, no
other lifetimes may be changed and the type must be otherwise the exact same type.
Required Associated Types§
Object Safety§
This trait is not object safe.