mirror of https://github.com/rwf2/Rocket.git
Use 'parking_lot' 'Mutex' in fairing's 'Once'.
This commit is contained in:
parent
d9f86d8647
commit
5e7a75e1a5
|
@ -1,6 +1,5 @@
|
||||||
use std::sync::Mutex;
|
|
||||||
|
|
||||||
use futures::future::{Future, BoxFuture, FutureExt};
|
use futures::future::{Future, BoxFuture, FutureExt};
|
||||||
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
use crate::{Rocket, Request, Response, Data, Build, Orbit};
|
use crate::{Rocket, Request, Response, Data, Build, Orbit};
|
||||||
use crate::fairing::{Fairing, Kind, Info, Result};
|
use crate::fairing::{Fairing, Kind, Info, Result};
|
||||||
|
@ -47,7 +46,7 @@ impl<F: ?Sized> Once<F> {
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn take(&self) -> Box<F> {
|
fn take(&self) -> Box<F> {
|
||||||
self.0.lock().expect("Once::lock()").take().expect("Once::take() called once")
|
self.0.lock().take().expect("Once::take() called once")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue