pub struct LifetimesMatterLittle<T>(/* private fields */);Expand description
Marker that indicates that all lifetimes in T are just relevant for the type itself, but not
for interactions. In particular, constructing it promises that:
-
The type is covariant in all lifetimes: Any
InputToT<'a>could be turned into anInputToT<'b>for a shorter'b.In practice, this means that no public interfaces of the type take input that needs to outlive the type (e.g. some
fn set_title(self, title: &'a str) { self.title = title }). -
It can not be observed through the type’s public interfaces how much longer its lifetime is than the reference that is passed in.
In practice, this means that there can be a
fn title(&self) -> &str, but nofn title(&self) -> &'a str.
Those properties are required to implement downcasting of generic messages into expected types,
see Message::downcast_from().
In the type system, we can not convey information about incomplete types. Thus, the statement
is encoded in a 'static concrete type T, but applies to the related types that vary by
lifetimes.