Trait ImagoAsRef

Source
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.

Required Methods§

Source

fn as_ref(&self) -> &'a T

Return a simple reference for self.

Implementations on Foreign Types§

Source§

impl<'a, B: BitmapSlice> ImagoAsRef<'a, VolatileSlice<'a, B>> for &'a VolatileSlice<'a, B>

Source§

fn as_ref(&self) -> &'a VolatileSlice<'a, B>

Source§

impl<'a, T: ?Sized, U: ImagoAsRef<'a, T>> ImagoAsRef<'a, T> for &'a U

Source§

fn as_ref(&self) -> &'a T

Implementors§