View

Trait View 

Source
pub trait View {
    type Ref<'a>
       where Self: 'a;

    // Required method
    fn view(&self) -> Self::Ref<'_>;
}
Expand description

Represents a type that can be ‘viewed’ (derefed). Mimics the impl for std::ops::Deref but makes use of GAT’s in order to provide non & refs. Useful for things like tensor views.

Required Associated Types§

Source

type Ref<'a> where Self: 'a

Required Methods§

Source

fn view(&self) -> Self::Ref<'_>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<D: Deref> View for D

Source§

type Ref<'a> = &'a <D as Deref>::Target where Self: 'a