3.4 KiB
0.7
-
actix::System
has new api.Instead of
fn main() { let sys = actix::System::new(..); HttpServer::new(|| ...).start() sys.run(); }
Server must be initialized within system run closure:
fn main() { actix::System::run(|| { HttpServer::new(|| ...).start() }); }
-
Middleware trait uses
&mut self
instead of&self
. -
Removed
Route::with2()
andRoute::with3()
use tuple of extractors instead.fn index((query, json): (Query<..>, Json<MyStruct)) -> impl Responder
-
Removed deprecated
HttpServer::threads()
, useHttpServer::workers()
instead.
0.6
-
Path<T>
extractor returnErrorNotFound
on failure instead ofErrorBadRequest
-
ws::Message::Close
now includes optional close reason.ws::CloseCode::Status
andws::CloseCode::Empty
have been removed. -
HttpServer::threads()
renamed toHttpServer::workers()
. -
HttpServer::start_ssl()
andHttpServer::start_tls()
deprecated. UseHttpServer::bind_ssl()
andHttpServer::bind_tls()
instead. -
HttpRequest::extensions()
returns read only reference to the request's ExtensionHttpRequest::extensions_mut()
returns mutable reference. -
Instead of
use actix_web::middleware::{ CookieSessionBackend, CookieSessionError, RequestSession, Session, SessionBackend, SessionImpl, SessionStorage};
use
actix_web::middleware::session
use actix_web::middleware::session{CookieSessionBackend, CookieSessionError, RequestSession, Session, SessionBackend, SessionImpl, SessionStorage};
-
FromRequest::from_request()
accepts mutable reference to a request -
FromRequest::Result
has to implementInto<Reply<Self>>
-
Responder::respond_to()
is generic overS
-
Use
Query
extractor instead of HttpRequest::query()`.fn index(q: Query<HashMap<String, String>>) -> Result<..> { ... }
or
let q = Query::<HashMap<String, String>>::extract(req);
-
Websocket operations are implemented as
WsWriter
trait. you need to useuse actix_web::ws::WsWriter
0.5
-
HttpResponseBuilder::body()
,.finish()
,.json()
methods returnHttpResponse
instead ofResult<HttpResponse>
-
actix_web::Method
,actix_web::StatusCode
,actix_web::Version
moved toactix_web::http
module -
actix_web::header
moved toactix_web::http::header
-
NormalizePath
moved toactix_web::http
module -
HttpServer
moved toactix_web::server
, added newactix_web::server::new()
function, shortcut foractix_web::server::HttpServer::new()
-
DefaultHeaders
middleware does not use separate builder, all builder methods moved to type itself -
StaticFiles::new()
's show_index parameter removed, useshow_files_listing()
method instead. -
CookieSessionBackendBuilder
removed, all methods moved toCookieSessionBackend
type -
actix_web::httpcodes
module is deprecated,HttpResponse::Ok()
,HttpResponse::Found()
and otherHttpResponse::XXX()
functions should be used instead -
ClientRequestBuilder::body()
returnsResult<_, actix_web::Error>
instead ofResult<_, http::Error>
-
Application
renamed to aApp
-
actix_web::Reply
,actix_web::Resource
moved toactix_web::dev