@@ -58,11 +58,6 @@
58// Re-export the `bumpalo` crate.
58// Re-export the `bumpalo` crate.
59pub use bumpalo;
59pub use bumpalo;
64−use wasm_bindgen::UnwrapThrowExt;
66// Only `pub` so that the wasm-bindgen bindings work.
61// Only `pub` so that the wasm-bindgen bindings work.
67#[doc(hidden)]
62#[doc(hidden)]
68pub mod change_list;
63pub mod change_list;
@@ -70,111 +65,11 @@ pub mod change_list;
70mod cached;
65mod cached;
71mod events;
66mod events;
75// Re-export items at the top level.
71// Re-export items at the top level.
76pub use self::cached::Cached;
72pub use self::cached::Cached;
77pub use self::node::{on, Attribute, ElementNode, Listener, ListenerCallback, Node, TextNode};
73pub use self::node::{on, Attribute, ElementNode, Listener, ListenerCallback, Node, TextNode};
74+pub use self::render::{Render, RootRender};
78pub use self::vdom::{Vdom, VdomWeak};
75pub use self::vdom::{Vdom, VdomWeak};
81− fn render<'a, 'bump>(&'a self, bump: &'bump Bump) -> Node<'bump>
86−impl<'r, R> Render for &'r R
90− fn render<'a, 'bump>(&'a self, bump: &'bump Bump) -> Node<'bump>
94− (**self).render(bump)
98−impl<R> Render for Rc<R>
102− fn render<'a, 'bump>(&'a self, bump: &'bump Bump) -> Node<'bump>
106− (**self).render(bump)
110−/// A `RootRender` is a render component that can be the root rendering component
111−/// mounted to a virtual DOM.
113−/// In addition to rendering, it must also be `'static` so that it can be owned
114−/// by the virtual DOM and `Any` so that it can be downcast to its concrete type
115−/// by event listener callbacks.
117−/// You do not need to implement this trait by hand: there is a blanket
118−/// implementation for all `Render` types that fulfill the `RootRender`
120−pub trait RootRender: Any + Render {
121− /// Get this `&RootRender` trait object as an `&Any` trait object reference.
122− fn as_any(&self) -> &Any;
124− /// Get this `&mut RootRender` trait object as an `&mut Any` trait object
126− fn as_any_mut(&mut self) -> &mut Any;
129−impl<T: Any + Render> RootRender for T {
130− fn as_any(&self) -> &Any {
134− fn as_any_mut(&mut self) -> &mut Any {
139−impl dyn RootRender {
140− /// Downcast this shared `&dyn RootRender` trait object reference to its
141− /// underlying concrete type.
145− /// Panics if this virtual DOM's root rendering component is not an `R`
147− pub fn unwrap_ref<R: RootRender>(&self) -> &R {
149− .downcast_ref::<R>()
150− .expect_throw("bad `RootRender::unwrap_ref` call")
153− /// Downcast this exclusive `&mut dyn RootRender` trait object reference to
154− /// its underlying concrete type.
158− /// Panics if this virtual DOM's root rendering component is not an `R`
160− pub fn unwrap_mut<R: RootRender>(&mut self) -> &mut R {
162− .downcast_mut::<R>()
163− .expect_throw("bad `RootRender::unwrap_ref` call")
170− fn render_is_object_safe() {
172− fn takes_dyn_render(_: &dyn super::Render) {}
176− fn root_render_is_object_safe() {
178− fn takes_dyn_render(_: &dyn super::RootRender) {}