From eaff67150cd745f87f60ec774c8341b497e81053 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sun, 19 Jun 2022 20:52:48 +0200 Subject: [PATCH] fix(actix-web-actors): formatting --- actix-web-actors/src/context.rs | 20 +++++++++---------- actix-web-actors/src/lib.rs | 18 ++++++++--------- actix-web-actors/src/ws.rs | 34 ++++++++++++++++----------------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/actix-web-actors/src/context.rs b/actix-web-actors/src/context.rs index a3852415f..f7b11c780 100644 --- a/actix-web-actors/src/context.rs +++ b/actix-web-actors/src/context.rs @@ -14,31 +14,31 @@ use futures_core::Stream; use tokio::sync::oneshot::Sender; /// Execution context for HTTP actors -/// +/// /// # Example -/// +/// /// A demonstration of [server-sent events](https://developer.mozilla.org/docs/Web/API/Server-sent_events) using actors: -/// +/// /// ```no_run /// use std::time::Duration; -/// +/// /// use actix::{Actor, AsyncContext}; /// use actix_web::{get, http::header, App, HttpResponse, HttpServer}; /// use actix_web_actors::HttpContext; /// use bytes::Bytes; -/// +/// /// struct MyActor { /// count: usize, /// } -/// +/// /// impl Actor for MyActor { /// type Context = HttpContext; -/// +/// /// fn started(&mut self, ctx: &mut Self::Context) { /// ctx.run_later(Duration::from_millis(100), Self::write); /// } /// } -/// +/// /// impl MyActor { /// fn write(&mut self, ctx: &mut HttpContext) { /// self.count += 1; @@ -50,14 +50,14 @@ use tokio::sync::oneshot::Sender; /// } /// } /// } -/// +/// /// #[get("/")] /// async fn index() -> HttpResponse { /// HttpResponse::Ok() /// .insert_header(header::ContentType(mime::TEXT_EVENT_STREAM)) /// .streaming(HttpContext::create(MyActor { count: 0 })) /// } -/// +/// /// #[actix_web::main] /// async fn main() -> std::io::Result<()> { /// HttpServer::new(|| App::new().service(index)) diff --git a/actix-web-actors/src/lib.rs b/actix-web-actors/src/lib.rs index 77c4a1653..106bc5202 100644 --- a/actix-web-actors/src/lib.rs +++ b/actix-web-actors/src/lib.rs @@ -1,19 +1,19 @@ //! Actix actors support for Actix Web. -//! +//! //! # Examples -//! +//! //! ```no_run //! use actix::{Actor, StreamHandler}; //! use actix_web::{get, web, App, Error, HttpRequest, HttpResponse, HttpServer}; //! use actix_web_actors::ws; -//! +//! //! /// Define Websocket actor //! struct MyWs; -//! +//! //! impl Actor for MyWs { //! type Context = ws::WebsocketContext; //! } -//! +//! //! /// Handler for ws::Message message //! impl StreamHandler> for MyWs { //! fn handle(&mut self, msg: Result, ctx: &mut Self::Context) { @@ -25,12 +25,12 @@ //! } //! } //! } -//! +//! //! #[get("/ws")] //! async fn index(req: HttpRequest, stream: web::Payload) -> Result { //! ws::start(MyWs, &req, stream) //! } -//! +//! //! #[actix_web::main] //! async fn main() -> std::io::Result<()> { //! HttpServer::new(|| App::new().service(index)) @@ -39,7 +39,7 @@ //! .await //! } //! ``` -//! +//! //! # Documentation & Community Resources //! In addition to this API documentation, several other resources are available: //! @@ -53,7 +53,7 @@ //! * [`ws`]: This module provides actor support for WebSockets. //! //! * [`HttpContext`]: This struct provides actor support for streaming HTTP responses. -//! +//! #![deny(rust_2018_idioms, nonstandard_style)] #![warn(future_incompatible)] diff --git a/actix-web-actors/src/ws.rs b/actix-web-actors/src/ws.rs index 29e67e787..9a4880159 100644 --- a/actix-web-actors/src/ws.rs +++ b/actix-web-actors/src/ws.rs @@ -1,19 +1,19 @@ //! Websocket integration. -//! +//! //! # Examples -//! +//! //! ```no_run //! use actix::{Actor, StreamHandler}; //! use actix_web::{get, web, App, Error, HttpRequest, HttpResponse, HttpServer}; //! use actix_web_actors::ws; -//! +//! //! /// Define Websocket actor //! struct MyWs; -//! +//! //! impl Actor for MyWs { //! type Context = ws::WebsocketContext; //! } -//! +//! //! /// Handler for ws::Message message //! impl StreamHandler> for MyWs { //! fn handle(&mut self, msg: Result, ctx: &mut Self::Context) { @@ -25,14 +25,14 @@ //! } //! } //! } -//! +//! //! #[get("/ws")] //! async fn websocket(req: HttpRequest, stream: web::Payload) -> Result { //! ws::start(MyWs, &req, stream) //! } -//! +//! //! const MAX_FRAME_SIZE: usize = 16_384; // 16KiB -//! +//! //! #[get("/custom-ws")] //! async fn custom_websocket(req: HttpRequest, stream: web::Payload) -> Result { //! // Create a Websocket session with a specific max frame size, and protocols. @@ -41,7 +41,7 @@ //! .protocols(&["A", "B"]) //! .start() //! } -//! +//! //! #[actix_web::main] //! async fn main() -> std::io::Result<()> { //! HttpServer::new(|| { @@ -54,7 +54,7 @@ //! .await //! } //! ``` -//! +//! use std::{ collections::VecDeque, @@ -101,25 +101,25 @@ use tokio::sync::oneshot; /// # use actix::{Actor, StreamHandler}; /// # use actix_web::{get, web, App, Error, HttpRequest, HttpResponse, HttpServer}; /// # use actix_web_actors::ws; -/// # +/// # /// # struct MyWs; -/// # +/// # /// # impl Actor for MyWs { /// # type Context = ws::WebsocketContext; /// # } -/// # +/// # /// # /// Handler for ws::Message message /// # impl StreamHandler> for MyWs { /// # fn handle(&mut self, msg: Result, ctx: &mut Self::Context) {} /// # } -/// # +/// # /// #[get("/ws")] /// async fn websocket(req: HttpRequest, stream: web::Payload) -> Result { /// ws::WsResponseBuilder::new(MyWs, &req, stream).start() /// } -/// +/// /// const MAX_FRAME_SIZE: usize = 16_384; // 16KiB -/// +/// /// #[get("/custom-ws")] /// async fn custom_websocket(req: HttpRequest, stream: web::Payload) -> Result { /// // Create a Websocket session with a specific max frame size, codec, and protocols. @@ -130,7 +130,7 @@ use tokio::sync::oneshot; /// .protocols(&["A", "B"]) /// .start() /// } -/// # +/// # /// # #[actix_web::main] /// # async fn main() -> std::io::Result<()> { /// # HttpServer::new(|| {