Skip to content

Commit

Permalink
fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
langyo committed Dec 9, 2023
1 parent 459e110 commit ec8ee8a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions website/docs/advanced-topics/server-side-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ Yew supports single thread mode for server-side rendering by `yew::LocalServerRe
```rust
// Build it by `wasm32-wasi` target

use anyhow::Result;
use yew::{prelude::*, LocalServerRenderer};
use yew::prelude::*;
use yew::LocalServerRenderer;

#[function_component]
fn App() -> Html {
Expand All @@ -216,7 +216,7 @@ fn App() -> Html {
}
}

pub async fn render() -> Result<String> {
pub async fn render() -> String {
let renderer = LocalServerRenderer::<App>::new();
let html_raw = renderer.render().await;

Expand All @@ -227,15 +227,12 @@ pub async fn render() -> Result<String> {
body.push_str("</div>");
body.push_str("</body>");

Ok(body)
body
}

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let ret = render().await?;
println!("{}", ret);

Ok(())
async fn main() {
println!("{}", render().await);
}
```

Expand Down

0 comments on commit ec8ee8a

Please sign in to comment.