pub trait TensorViewer: 'static {
    type View<'a, Mod: 'a>
       where Self: 'a;

    // Required method
    fn view_field<'a, Mod, Field, GetRef, GetMut>(
        module: &'a mut Self::View<'_, Mod>,
        name: &str,
        get_ref: &mut GetRef,
        get_mut: &mut GetMut
    ) -> Self::View<'a, Field>
       where GetRef: FnMut(&Mod) -> &Field,
             GetMut: FnMut(&mut Mod) -> &mut Field;
}
Expand description

Something that can view Tensors in different ways. For example ViewTensorRef can view &Tensor, and ViewTensorMut can view `&mut Tensor.

Required Associated Types§

source

type View<'a, Mod: 'a> where Self: 'a

Required Methods§

source

fn view_field<'a, Mod, Field, GetRef, GetMut>( module: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

Given a view of a module, returns a view of one of that module’s fields

Implementations on Foreign Types§

source§

impl<T: TensorViewer> TensorViewer for Vec<T>

§

type View<'a, Mod: 'a> = Vec<<T as TensorViewer>::View<'a, Mod>, Global>

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( module: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

source§

impl<M1: TensorViewer, M2: TensorViewer, M3: TensorViewer, M4: TensorViewer> TensorViewer for (M1, M2, M3, M4)

§

type View<'a, Mod: 'a> = (<M1 as TensorViewer>::View<'a, Mod>, <M2 as TensorViewer>::View<'a, Mod>, <M3 as TensorViewer>::View<'a, Mod>, <M4 as TensorViewer>::View<'a, Mod>)

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( visitor: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

source§

impl<M1: TensorViewer, M2: TensorViewer, M3: TensorViewer, M4: TensorViewer, M5: TensorViewer, M6: TensorViewer> TensorViewer for (M1, M2, M3, M4, M5, M6)

§

type View<'a, Mod: 'a> = (<M1 as TensorViewer>::View<'a, Mod>, <M2 as TensorViewer>::View<'a, Mod>, <M3 as TensorViewer>::View<'a, Mod>, <M4 as TensorViewer>::View<'a, Mod>, <M5 as TensorViewer>::View<'a, Mod>, <M6 as TensorViewer>::View<'a, Mod>)

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( visitor: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

source§

impl<M1: TensorViewer, M2: TensorViewer, M3: TensorViewer> TensorViewer for (M1, M2, M3)

§

type View<'a, Mod: 'a> = (<M1 as TensorViewer>::View<'a, Mod>, <M2 as TensorViewer>::View<'a, Mod>, <M3 as TensorViewer>::View<'a, Mod>)

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( visitor: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

source§

impl<M1: TensorViewer> TensorViewer for (M1,)

§

type View<'a, Mod: 'a> = (<M1 as TensorViewer>::View<'a, Mod>,)

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( visitor: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

source§

impl TensorViewer for ()

§

type View<'a, Mod: 'a> = ()

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( _module: &mut (), _name: &str, _get_ref: &mut GetRef, _get_mut: &mut GetMut )where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

source§

impl<M1: TensorViewer, M2: TensorViewer, M3: TensorViewer, M4: TensorViewer, M5: TensorViewer> TensorViewer for (M1, M2, M3, M4, M5)

§

type View<'a, Mod: 'a> = (<M1 as TensorViewer>::View<'a, Mod>, <M2 as TensorViewer>::View<'a, Mod>, <M3 as TensorViewer>::View<'a, Mod>, <M4 as TensorViewer>::View<'a, Mod>, <M5 as TensorViewer>::View<'a, Mod>)

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( visitor: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

source§

impl<T: TensorViewer> TensorViewer for Option<T>

§

type View<'a, Mod: 'a> = Option<<T as TensorViewer>::View<'a, Mod>>

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( module: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

source§

impl<M1: TensorViewer, M2: TensorViewer> TensorViewer for (M1, M2)

§

type View<'a, Mod: 'a> = (<M1 as TensorViewer>::View<'a, Mod>, <M2 as TensorViewer>::View<'a, Mod>)

source§

fn view_field<'a, Mod, Field, GetRef, GetMut>( visitor: &'a mut Self::View<'_, Mod>, name: &str, get_ref: &mut GetRef, get_mut: &mut GetMut ) -> Self::View<'a, Field>where GetRef: FnMut(&Mod) -> &Field, GetMut: FnMut(&mut Mod) -> &mut Field,

Implementors§