Merge pull request #1897 from Andrew15-5/fix-liveview-adapter-comments

docs(liveview): fixed adapter comments
This commit is contained in:
Evan Almloff 2024-02-05 12:41:18 -06:00 committed by GitHub
commit 61e2478fbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 9 deletions

View file

@ -2,9 +2,9 @@ use crate::{LiveViewError, LiveViewSocket};
use axum::extract::ws::{Message, WebSocket};
use futures_util::{SinkExt, StreamExt};
/// Convert a warp websocket into a LiveViewSocket
/// Convert an Axum WebSocket into a `LiveViewSocket`.
///
/// This is required to launch a LiveView app using the warp web framework
/// This is required to launch a LiveView app using the Axum web framework.
pub fn axum_socket(ws: WebSocket) -> impl LiveViewSocket {
ws.map(transform_rx)
.with(transform_tx)

View file

@ -2,9 +2,9 @@ use crate::{LiveViewError, LiveViewSocket};
use rocket::futures::{SinkExt, StreamExt};
use rocket_ws::{result::Error, stream::DuplexStream, Message};
/// Convert a rocket websocket into a LiveViewSocket
/// Convert a Rocket WebSocket into a `LiveViewSocket`.
///
/// This is required to launch a LiveView app using the rocket web framework
/// This is required to launch a LiveView app using the Rocket web framework.
pub fn rocket_socket(stream: DuplexStream) -> impl LiveViewSocket {
stream
.map(transform_rx)

View file

@ -3,9 +3,9 @@ use salvo::ws::{Message, WebSocket};
use crate::{LiveViewError, LiveViewSocket};
/// Convert a salvo websocket into a LiveViewSocket
/// Convert a Salvo WebSocket into a `LiveViewSocket`.
///
/// This is required to launch a LiveView app using the warp web framework
/// This is required to launch a LiveView app using the Salvo web framework.
pub fn salvo_socket(ws: WebSocket) -> impl LiveViewSocket {
ws.map(transform_rx)
.with(transform_tx)

View file

@ -2,9 +2,9 @@ use crate::{LiveViewError, LiveViewSocket};
use futures_util::{SinkExt, StreamExt};
use warp::ws::{Message, WebSocket};
/// Convert a warp websocket into a LiveViewSocket
/// Convert a warp WebSocket into a `LiveViewSocket`.
///
/// This is required to launch a LiveView app using the warp web framework
/// This is required to launch a LiveView app using the warp web framework.
pub fn warp_socket(ws: WebSocket) -> impl LiveViewSocket {
ws.map(transform_rx)
.with(transform_tx)
@ -12,7 +12,7 @@ pub fn warp_socket(ws: WebSocket) -> impl LiveViewSocket {
}
fn transform_rx(message: Result<Message, warp::Error>) -> Result<Vec<u8>, LiveViewError> {
// destructure the message into the buffer we got from warp
// Destructure the `message` into the buffer we got from warp.
let msg = message
.map_err(|_| LiveViewError::SendingFailed)?
.into_bytes();