1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 08:45:10 +02:00

Allow to set/override app data on scope level

This commit is contained in:
Nikolay Kim
2019-05-12 09:42:05 -07:00
parent df08baf67f
commit 45c05978b0
6 changed files with 90 additions and 20 deletions

View File

@ -93,12 +93,6 @@ impl<T> Clone for Data<T> {
}
}
impl<T> From<T> for Data<T> {
fn from(data: T) -> Self {
Data::new(data)
}
}
impl<T: 'static> FromRequest for Data<T> {
type Config = ();
type Error = Error;
@ -135,6 +129,7 @@ impl<T: 'static> DataFactory for Data<T> {
#[cfg(test)]
mod tests {
use actix_service::Service;
use std::sync::Mutex;
use crate::http::StatusCode;
use crate::test::{block_on, init_service, TestRequest};