Trait kobold::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 &u128

§

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 isize

§

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 &u64

§

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 &i8

§

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 i128

§

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 &i16

§

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 u32

§

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 &i128

§

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 f32

§

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 &bool

§

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 &u32

§

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 &usize

§

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 i16

§

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 &u8

§

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<V: View, const N: usize> View for [V; N]

§

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 View for i8

§

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<'a> View for &&'a str

§

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,

§

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 View for i64

§

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 u128

§

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 &String

§

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 usize

§

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 &i32

§

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 bool

§

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 i32

§

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 &f32

§

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

§

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<T: View> View for Option<T>

§

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 View for u8

§

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

§

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 f64

§

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 &i64

§

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 u64

§

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 &str

§

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 &isize

§

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<V: View> View for Vec<V>

§

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 View for String

§

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 View for u16

§

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)

Implementors§

source§

impl View for &Ref<str>

§

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

source§

impl View for &VString

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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),

§

type Product = <V as View>::Product

source§

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

§

type Product = <V as View>::Product