pub struct ServerRenderer<COMP>where
COMP: BaseComponent,{ /* private fields */ }
Available on crate feature
ssr
only.Expand description
A Yew Server-side Renderer.
This renderer spawns the rendering task to a Yew Runtime
. and receives result when
the rendering process has finished.
See yew::platform
for more information.
Implementations§
source§impl<COMP> ServerRenderer<COMP>
impl<COMP> ServerRenderer<COMP>
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a ServerRenderer with default properties.
source§impl<COMP> ServerRenderer<COMP>where
COMP: BaseComponent,
impl<COMP> ServerRenderer<COMP>where
COMP: BaseComponent,
sourcepub fn with_props<F>(create_props: F) -> Self
pub fn with_props<F>(create_props: F) -> Self
Creates a ServerRenderer with custom properties.
§Note
The properties does not have to implement Send
.
However, the function to create properties needs to be Send
.
sourcepub fn with_runtime(self, rt: Runtime) -> Self
pub fn with_runtime(self, rt: Runtime) -> Self
Sets the runtime the ServerRenderer will run the rendering task with.
sourcepub fn hydratable(self, val: bool) -> Self
pub fn hydratable(self, val: bool) -> Self
Sets whether an the rendered result is hydratable.
Defaults to true
.
When this is sets to true
, the rendered artifact will include additional information
to assist with the hydration process.
sourcepub async fn render_to_string(self, w: &mut String)
pub async fn render_to_string(self, w: &mut String)
Renders Yew Application to a String.
sourcepub fn render_stream(self) -> impl Send + Stream<Item = String>
pub fn render_stream(self) -> impl Send + Stream<Item = String>
Renders Yew Application into a string Stream.
Trait Implementations§
source§impl<COMP> Debug for ServerRenderer<COMP>where
COMP: BaseComponent,
impl<COMP> Debug for ServerRenderer<COMP>where
COMP: BaseComponent,
source§impl<COMP> Default for ServerRenderer<COMP>
impl<COMP> Default for ServerRenderer<COMP>
Auto Trait Implementations§
impl<COMP> Freeze for ServerRenderer<COMP>
impl<COMP> !RefUnwindSafe for ServerRenderer<COMP>
impl<COMP> Send for ServerRenderer<COMP>
impl<COMP> !Sync for ServerRenderer<COMP>
impl<COMP> Unpin for ServerRenderer<COMP>
impl<COMP> !UnwindSafe for ServerRenderer<COMP>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self
to a value of a Properties
struct.source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self
to a value of a Properties
struct.