comet/core/
component.rs

1use async_trait::async_trait;
2use percy_dom::prelude::*;
3
4pub type Html = VirtualNode;
5
6use crate::prelude::Shared;
7
8#[async_trait(?Send)]
9pub trait Component<Msg>: Send + Sync + 'static
10where
11    Msg: Clone + 'static,
12    Self: Sized,
13{
14    async fn update(&mut self, msg: Msg);
15    async fn update_bindings(&mut self, bindings: Shared<Vec<String>>);
16    async fn view(&self, shared_self: Shared<Self>) -> Html;
17}
18
19#[async_trait(?Send)]
20pub trait ToVirtualNode {
21    async fn to_virtual_node(self) -> VirtualNode;
22}