From b1523ab78c300b2e39aad9fa4139de56d88bf8c3 Mon Sep 17 00:00:00 2001 From: Darin Date: Sat, 6 Apr 2019 10:39:20 -0400 Subject: [PATCH] started 1.0 migration guide (#758) --- MIGRATION.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/MIGRATION.md b/MIGRATION.md index 6b49e3e6a..372d68930 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,3 +1,58 @@ +## 1.0 + +* `State` is now `Data`. You register Data during the App initialization process +and then access it from handlers either using a Data extractor or using +HttpRequest's api. + + instead of + + ```rust + App.with_state(T) + ``` + + use App's `data` method + + ```rust + App.new() + .data(T) + ``` + + and either use the Data extractor within your handler + + ```rust + use actix_web::web::Data; + + fn endpoint_handler(Data)){ + ... + } + ``` + + .. or access your Data element from the HttpRequest + + ```rust + fn endpoint_handler(req: HttpRequest) { + let data: Option> = req.app_data::(); + } + ``` + + +* AsyncResponder is deprecated. + + instead of + + ```rust + use actix_web::AsyncResponder; + + fn endpoint_handler(...) -> impl Future{ + ... + .responder() + } + ``` + + .. simply omit AsyncResponder and the corresponding responder() finish method + + + ## 0.7.15 * The `' '` character is not percent decoded anymore before matching routes. If you need to use it in