Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions contrib/ws/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
//!
//! Then, use [`WebSocket`] as a request guard in any route and either call
//! [`WebSocket::channel()`] or return a stream via [`Stream!`] or
//! [`WebSocket::stream()`] in the handler. The examples below are equivalent:
//! [`WebSocket::stream()`] in the handler. The endpoints in the example below are equivalent:
//!
//! ```rust
//! # use rocket::get;
//! # use rocket_ws as ws;
//! #
//! #[get("/echo?channel")]
//! #[get("/echo/channel")]
//! fn echo_channel(ws: ws::WebSocket) -> ws::Channel<'static> {
//! use rocket::futures::{SinkExt, StreamExt};
//!
Expand All @@ -34,7 +34,7 @@
//! }))
//! }
//!
//! #[get("/echo?stream")]
//! #[get("/echo/stream")]
//! fn echo_stream(ws: ws::WebSocket) -> ws::Stream!['static] {
//! ws::Stream! { ws =>
//! for await message in ws {
Expand All @@ -43,7 +43,7 @@
//! }
//! }
//!
//! #[get("/echo?compose")]
//! #[get("/echo/compose")]
//! fn echo_compose(ws: ws::WebSocket) -> ws::Stream!['static] {
//! ws.stream(|io| io)
//! }
Expand Down
4 changes: 2 additions & 2 deletions contrib/ws/src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl WebSocket {
/// # use rocket_ws as ws;
///
/// // Use `Stream!`, which internally calls `WebSocket::stream()`.
/// #[get("/echo?stream")]
/// #[get("/echo/stream")]
/// fn echo_stream(ws: ws::WebSocket) -> ws::Stream!['static] {
/// ws::Stream! { ws =>
/// for await message in ws {
Expand All @@ -144,7 +144,7 @@ impl WebSocket {
/// }
///
/// // Use a raw stream.
/// #[get("/echo?compose")]
/// #[get("/echo/compose")]
/// fn echo_compose(ws: ws::WebSocket) -> ws::Stream!['static] {
/// ws.stream(|io| io)
/// }
Expand Down