pub trait ImagoAsRef<'a, T: ?Sized> {
// Required method
fn as_ref(&self) -> &'a T;
}
Expand description
Similar to AsRef
, but for types where AsRef
is not implemented.
When we need AsRef
for a type but it is not implemented in its origin crate, there is no way
but to provide a local trait that we can implement here. Because there are no negative trait
bounds, we cannot implement this for AsRef
(to have a common trait).
Also includes a lifetime so that it is possible to borrow things for longer.