浏览代码

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

docs(liveview): fixed adapter comments
Evan Almloff 1 年之前
父节点
当前提交
61e2478fbf

+ 2 - 2
packages/liveview/src/adapters/axum_adapter.rs

@@ -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 - 2
packages/liveview/src/adapters/rocket_adapter.rs

@@ -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)

+ 2 - 2
packages/liveview/src/adapters/salvo_adapter.rs

@@ -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)

+ 3 - 3
packages/liveview/src/adapters/warp_adapter.rs

@@ -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();