mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 14:44:12 +00:00
Merge pull request #1897 from Andrew15-5/fix-liveview-adapter-comments
docs(liveview): fixed adapter comments
This commit is contained in:
commit
61e2478fbf
4 changed files with 9 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue