1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-02 01:31:57 +02:00

clarify resource/scope app data overriding (#1476)

* relocate FnDataFactory

* clarify app data overriding in Scope and Resource

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
This commit is contained in:
Rob Ede
2020-04-29 18:20:47 +01:00
committed by GitHub
parent bb17280f51
commit c27d3fad8e
6 changed files with 191 additions and 108 deletions

View File

@@ -3,7 +3,7 @@ use std::sync::Arc;
use actix_http::error::{Error, ErrorInternalServerError};
use actix_http::Extensions;
use futures::future::{err, ok, Ready};
use futures::future::{err, ok, LocalBoxFuture, Ready};
use crate::dev::Payload;
use crate::extract::FromRequest;
@@ -14,6 +14,9 @@ pub(crate) trait DataFactory {
fn create(&self, extensions: &mut Extensions) -> bool;
}
pub(crate) type FnDataFactory =
Box<dyn Fn() -> LocalBoxFuture<'static, Result<Box<dyn DataFactory>, ()>>>;
/// Application data.
///
/// Application data is an arbitrary data attached to the app.