pub struct Renderer {
pub pre_render: bool,
/* private fields */
}
Expand description
A virtualdom renderer that caches the templates it has seen for faster rendering
Fields§
§pre_render: bool
Choose to write ElementIDs into elements so the page can be re-hydrated later on
Implementations§
Source§impl Renderer
impl Renderer
pub fn new() -> Self
Sourcepub fn set_render_components(
&mut self,
callback: impl Fn(&mut Renderer, &mut dyn Write, &VirtualDom, ScopeId) -> Result + Send + Sync + 'static,
)
pub fn set_render_components( &mut self, callback: impl Fn(&mut Renderer, &mut dyn Write, &VirtualDom, ScopeId) -> Result + Send + Sync + 'static, )
Set the callback that the renderer uses to render components
Sourcepub fn reset_render_components(&mut self)
pub fn reset_render_components(&mut self)
Reset the callback that the renderer uses to render components
pub fn render(&mut self, dom: &VirtualDom) -> String
pub fn render_to<W: Write + ?Sized>( &mut self, buf: &mut W, dom: &VirtualDom, ) -> Result
Sourcepub fn render_element(&mut self, element: Element) -> String
pub fn render_element(&mut self, element: Element) -> String
Render an element to a string
Sourcepub fn render_element_to<W: Write + ?Sized>(
&mut self,
buf: &mut W,
element: Element,
) -> Result
pub fn render_element_to<W: Write + ?Sized>( &mut self, buf: &mut W, element: Element, ) -> Result
Render an element to the buffer
Sourcepub fn reset_hydration(&mut self)
pub fn reset_hydration(&mut self)
Reset the renderer hydration state
pub fn render_scope<W: Write + ?Sized>( &mut self, buf: &mut W, dom: &VirtualDom, scope: ScopeId, ) -> Result
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Renderer
impl !RefUnwindSafe for Renderer
impl Send for Renderer
impl Sync for Renderer
impl Unpin for Renderer
impl !UnwindSafe for Renderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.