mirror of
https://github.com/actix/examples
synced 2025-06-26 09:17:41 +02:00
chore: fmt
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
use std::{convert::Infallible, io};
|
||||
|
||||
use actix_files::{Files, NamedFile};
|
||||
use actix_session::{storage::CookieSessionStore, Session, SessionMiddleware};
|
||||
use actix_session::{Session, SessionMiddleware, storage::CookieSessionStore};
|
||||
use actix_web::{
|
||||
error, get,
|
||||
App, Either, HttpRequest, HttpResponse, HttpServer, Responder, Result, error, get,
|
||||
http::{
|
||||
header::{self, ContentType},
|
||||
Method, StatusCode,
|
||||
header::{self, ContentType},
|
||||
},
|
||||
middleware, web, App, Either, HttpRequest, HttpResponse, HttpServer, Responder, Result,
|
||||
middleware, web,
|
||||
};
|
||||
use actix_web_lab::extract::Path;
|
||||
use async_stream::stream;
|
||||
|
@ -12,11 +12,11 @@ http errors will be chosen, each with an equal chance of being selected:
|
||||
|
||||
*/
|
||||
|
||||
use actix_web::{web, App, Error, HttpResponse, HttpServer, ResponseError};
|
||||
use actix_web::{App, Error, HttpResponse, HttpServer, ResponseError, web};
|
||||
use derive_more::Display;
|
||||
use rand::{
|
||||
distr::{Distribution, StandardUniform},
|
||||
Rng,
|
||||
distr::{Distribution, StandardUniform},
|
||||
};
|
||||
|
||||
#[derive(Debug, Display)]
|
||||
|
@ -1,4 +1,4 @@
|
||||
use actix_web::{middleware, web, App, HttpRequest, HttpServer};
|
||||
use actix_web::{App, HttpRequest, HttpServer, middleware, web};
|
||||
|
||||
async fn index(req: HttpRequest) -> &'static str {
|
||||
println!("REQ: {req:?}");
|
||||
@ -25,7 +25,7 @@ async fn main() -> std::io::Result<()> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use actix_web::{body::to_bytes, dev::Service, http, test, Error};
|
||||
use actix_web::{Error, body::to_bytes, dev::Service, http, test};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use actix_web::{web, Error, HttpResponse};
|
||||
use actix_web::{Error, HttpResponse, web};
|
||||
|
||||
use crate::common::{Part, Product};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use actix_web::{web, Error, HttpResponse};
|
||||
use actix_web::{Error, HttpResponse, web};
|
||||
|
||||
use crate::common::{Part, Product};
|
||||
|
||||
@ -21,9 +21,10 @@ pub async fn remove_product(_id: web::Path<String>) -> Result<HttpResponse, Erro
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use actix_web::{
|
||||
App,
|
||||
dev::Service,
|
||||
http::{header, StatusCode},
|
||||
test, App,
|
||||
http::{StatusCode, header},
|
||||
test,
|
||||
};
|
||||
|
||||
use crate::app_config::config_app;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use actix_web::{middleware, App, HttpServer};
|
||||
use actix_web::{App, HttpServer, middleware};
|
||||
use nested_routing::app_config::config_app;
|
||||
|
||||
#[actix_web::main]
|
||||
|
@ -22,15 +22,14 @@ use std::{
|
||||
cell::Cell,
|
||||
io,
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Mutex,
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
},
|
||||
};
|
||||
|
||||
use actix_web::{
|
||||
middleware,
|
||||
App, HttpRequest, HttpResponse, HttpServer, middleware,
|
||||
web::{self, Data},
|
||||
App, HttpRequest, HttpResponse, HttpServer,
|
||||
};
|
||||
|
||||
/// simple handle
|
||||
|
@ -1,5 +1,5 @@
|
||||
use actix_files::Files;
|
||||
use actix_web::{middleware::Logger, App, HttpServer};
|
||||
use actix_web::{App, HttpServer, middleware::Logger};
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use actix_files::NamedFile;
|
||||
use actix_session::Session;
|
||||
use actix_web::{
|
||||
dev, error, http::StatusCode, middleware::ErrorHandlerResponse, web, Error, HttpResponse,
|
||||
Responder, Result,
|
||||
Error, HttpResponse, Responder, Result, dev, error, http::StatusCode,
|
||||
middleware::ErrorHandlerResponse, web,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
|
@ -1,11 +1,11 @@
|
||||
use std::{env, io};
|
||||
|
||||
use actix_files::Files;
|
||||
use actix_session::{storage::CookieSessionStore, SessionMiddleware};
|
||||
use actix_session::{SessionMiddleware, storage::CookieSessionStore};
|
||||
use actix_web::{
|
||||
http,
|
||||
App, HttpServer, http,
|
||||
middleware::{ErrorHandlers, Logger},
|
||||
web, App, HttpServer,
|
||||
web,
|
||||
};
|
||||
use dotenvy::dotenv;
|
||||
use tera::Tera;
|
||||
|
Reference in New Issue
Block a user