Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
levkk committed Oct 31, 2024
1 parent a305d68 commit d2b16ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/docs/views/turbo/streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ if let Some(session_id) = session_id {
</div>
"#).action("replace");

let message = Message::Text(update.render());

// Send it via a WebSocket connection.
Comms::websocket(&session_id).send(update)?;
Comms::websocket(&session_id).send(message)?;
}
```

Expand Down
6 changes: 6 additions & 0 deletions rwf/src/view/turbo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ pub struct TurboStream {
target: String,
}

impl std::fmt::Display for TurboStream {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.clone().render())
}
}

impl From<TurboStream> for Context {
fn from(stream: TurboStream) -> Context {
let mut context = Context::new();
Expand Down

0 comments on commit d2b16ea

Please sign in to comment.