mirror of
https://github.com/actix/actix-web.git
synced 2024-12-30 12:00:38 +00:00
make State type Send compatible
This commit is contained in:
parent
3fc28c5d07
commit
db566a634c
1 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::rc::Rc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use actix_http::error::{Error, ErrorInternalServerError};
|
use actix_http::error::{Error, ErrorInternalServerError};
|
||||||
use actix_http::Extensions;
|
use actix_http::Extensions;
|
||||||
|
@ -18,11 +18,11 @@ pub(crate) trait StateFactoryResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Application state
|
/// Application state
|
||||||
pub struct State<T>(Rc<T>);
|
pub struct State<T>(Arc<T>);
|
||||||
|
|
||||||
impl<T> State<T> {
|
impl<T> State<T> {
|
||||||
pub(crate) fn new(state: T) -> State<T> {
|
pub(crate) fn new(state: T) -> State<T> {
|
||||||
State(Rc::new(state))
|
State(Arc::new(state))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get referecnce to inner state type.
|
/// Get referecnce to inner state type.
|
||||||
|
|
Loading…
Reference in a new issue