Trait View

Source
pub trait View {
    type Product: Mountable;

    // Required methods
    fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>;
    fn update(self, p: &mut Self::Product);

    // Provided methods
    fn on_mount<F>(self, handler: F) -> OnMount<Self, F>
       where F: FnOnce(&<Self::Product as Mountable>::Js),
             Self: Sized { ... }
    fn on_render<F>(self, handler: F) -> OnRender<Self, F>
       where F: FnOnce(&<Self::Product as Mountable>::Js),
             Self: Sized { ... }
}
Expand description

Trait that describes types that can be rendered in the DOM.

Required Associated Types§

Source

type Product: Mountable

The product should contain a DOM reference to this View and any data it needs to update itself.

Required Methods§

Source

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Build a product that can be mounted in the DOM from this type.

Source

fn update(self, p: &mut Self::Product)

Update the product and apply changes to the DOM if necessary.

Provided Methods§

Source

fn on_mount<F>(self, handler: F) -> OnMount<Self, F>
where F: FnOnce(&<Self::Product as Mountable>::Js), Self: Sized,

Once this view is built, do something once.

Source

fn on_render<F>(self, handler: F) -> OnRender<Self, F>
where F: FnOnce(&<Self::Product as Mountable>::Js), Self: Sized,

Similar to on_mount but triggers on every update, not just initial render.

Implementations on Foreign Types§

Source§

impl View for &bool

Source§

type Product = <bool as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &f32

Source§

type Product = <f32 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &f64

Source§

type Product = <f64 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &i8

Source§

type Product = <i8 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &i16

Source§

type Product = <i16 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &i32

Source§

type Product = <i32 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &i64

Source§

type Product = <i64 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &i128

Source§

type Product = <i128 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &isize

Source§

type Product = <isize as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &str

Source§

type Product = TextProduct<<&str as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &u8

Source§

type Product = <u8 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &u16

Source§

type Product = <u16 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &u32

Source§

type Product = <u32 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &u64

Source§

type Product = <u64 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &u128

Source§

type Product = <u128 as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &usize

Source§

type Product = <usize as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for &String

Source§

type Product = TextProduct<<&String as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for bool

Source§

type Product = TextProduct<<bool as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for f32

Source§

type Product = TextProduct<<f32 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for f64

Source§

type Product = TextProduct<<f64 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for i8

Source§

type Product = TextProduct<<i8 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for i16

Source§

type Product = TextProduct<<i16 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for i32

Source§

type Product = TextProduct<<i32 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for i64

Source§

type Product = TextProduct<<i64 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for i128

Source§

type Product = TextProduct<<i128 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for isize

Source§

type Product = TextProduct<<isize as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for u8

Source§

type Product = TextProduct<<u8 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for u16

Source§

type Product = TextProduct<<u16 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for u32

Source§

type Product = TextProduct<<u32 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for u64

Source§

type Product = TextProduct<<u64 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for u128

Source§

type Product = TextProduct<<u128 as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for usize

Source§

type Product = TextProduct<<usize as Diff>::Memo>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl View for String

Source§

type Product = TextProduct<String>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl<'a> View for &&'a str

Source§

type Product = <&'a str as View>::Product

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl<'a, V> View for &'a [V]
where &'a V: View,

Source§

type Product = ListProduct<<&'a V as View>::Product>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl<T: View> View for Option<T>

Source§

type Product = Branch2<<T as View>::Product, EmptyNode>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl<V: View> View for Vec<V>

Source§

type Product = ListProduct<<V as View>::Product>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Source§

impl<V: View, const N: usize> View for [V; N]

Source§

type Product = ListProduct<<V as View>::Product>

Source§

fn build(self, p: In<'_, Self::Product>) -> Out<'_, Self::Product>

Source§

fn update(self, p: &mut Self::Product)

Implementors§

Source§

impl View for &Ref<str>

Source§

type Product = TextProduct<<&Ref<str> as Diff>::Memo>

Source§

impl View for &VString

Source§

type Product = TextProduct<<&VString as Diff>::Memo>

Source§

impl View for Empty

Source§

impl<'a, V> View for &'a Hook<V>
where &'a V: View + 'a,

Source§

impl<A, B> View for Branch2<A, B>
where A: View, B: View,

Source§

type Product = Branch2<<A as View>::Product, <B as View>::Product>

Source§

impl<A, B, C> View for Branch3<A, B, C>
where A: View, B: View, C: View,

Source§

type Product = Branch3<<A as View>::Product, <B as View>::Product, <C as View>::Product>

Source§

impl<A, B, C, D> View for Branch4<A, B, C, D>
where A: View, B: View, C: View, D: View,

Source§

type Product = Branch4<<A as View>::Product, <B as View>::Product, <C as View>::Product, <D as View>::Product>

Source§

impl<A, B, C, D, E> View for Branch5<A, B, C, D, E>
where A: View, B: View, C: View, D: View, E: View,

Source§

type Product = Branch5<<A as View>::Product, <B as View>::Product, <C as View>::Product, <D as View>::Product, <E as View>::Product>

Source§

impl<A, B, C, D, E, F> View for Branch6<A, B, C, D, E, F>
where A: View, B: View, C: View, D: View, E: View, F: View,

Source§

type Product = Branch6<<A as View>::Product, <B as View>::Product, <C as View>::Product, <D as View>::Product, <E as View>::Product, <F as View>::Product>

Source§

impl<A, B, C, D, E, F, G> View for Branch7<A, B, C, D, E, F, G>
where A: View, B: View, C: View, D: View, E: View, F: View, G: View,

Source§

type Product = Branch7<<A as View>::Product, <B as View>::Product, <C as View>::Product, <D as View>::Product, <E as View>::Product, <F as View>::Product, <G as View>::Product>

Source§

impl<A, B, C, D, E, F, G, H> View for Branch8<A, B, C, D, E, F, G, H>
where A: View, B: View, C: View, D: View, E: View, F: View, G: View, H: View,

Source§

type Product = Branch8<<A as View>::Product, <B as View>::Product, <C as View>::Product, <D as View>::Product, <E as View>::Product, <F as View>::Product, <G as View>::Product, <H as View>::Product>

Source§

impl<A, B, C, D, E, F, G, H, I> View for Branch9<A, B, C, D, E, F, G, H, I>
where A: View, B: View, C: View, D: View, E: View, F: View, G: View, H: View, I: View,

Source§

type Product = Branch9<<A as View>::Product, <B as View>::Product, <C as View>::Product, <D as View>::Product, <E as View>::Product, <F as View>::Product, <G as View>::Product, <H as View>::Product, <I as View>::Product>

Source§

impl<D, F, V> View for Fence<D, F>
where D: Diff, F: FnOnce() -> V, V: View,

Source§

type Product = Fence<<D as Diff>::Memo, <V as View>::Product>

Source§

impl<F> View for Precompiled<F>
where F: Fn() -> Node,

Source§

impl<S, F, V> View for Stateful<S, F>
where S: IntoState, F: Fn(*const Hook<S::State>) -> V + 'static, V: View,

Source§

impl<S, R, F, P> View for Once<S, R, F>
where S: IntoState, F: FnOnce(Signal<S::State>) -> P, P: 'static, Stateful<S, R>: View<Product = StatefulProduct<S::State>>,

Source§

impl<T> View for Eager<T>
where T: Value<TextContent> + IntoText + Copy,

Source§

impl<T> View for Static<T>
where T: Value<TextContent> + IntoText + Copy,

Source§

impl<T> View for List<T>
where T: IntoIterator, <T as IntoIterator>::Item: View,

Source§

impl<V, F> View for OnMount<V, F>
where V: View, F: FnOnce(&<V::Product as Mountable>::Js),

Source§

impl<V, F> View for OnRender<V, F>
where V: View, F: FnOnce(&<V::Product as Mountable>::Js),