1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-01-18 13:01:49 +01:00

deprecate rt TLS item storage

This commit is contained in:
Rob Ede 2021-01-31 04:48:03 +00:00
parent 0eb68d1c7b
commit 0b656f51e1
No known key found for this signature in database
GPG Key ID: C2A3B36E841A91E6
2 changed files with 5 additions and 0 deletions

View File

@ -218,11 +218,13 @@ impl Arbiter {
/// Insert item into Arbiter's thread-local storage.
///
/// Overwrites any item of the same type previously inserted.
#[deprecated = "Will be removed in stable v2."]
pub fn set_item<T: 'static>(item: T) {
STORAGE.with(move |cell| cell.borrow_mut().insert(TypeId::of::<T>(), Box::new(item)));
}
/// Check if Arbiter's thread-local storage contains an item type.
#[deprecated = "Will be removed in stable v2."]
pub fn contains_item<T: 'static>() -> bool {
STORAGE.with(move |cell| cell.borrow().contains_key(&TypeId::of::<T>()))
}
@ -231,6 +233,7 @@ impl Arbiter {
///
/// # Panics
/// Panics if item is not in Arbiter's thread-local item storage.
#[deprecated = "Will be removed in stable v2."]
pub fn get_item<T: 'static, F, R>(mut f: F) -> R
where
F: FnMut(&T) -> R,
@ -249,6 +252,7 @@ impl Arbiter {
///
/// # Panics
/// Panics if item is not in Arbiter's thread-local item storage.
#[deprecated = "Will be removed in stable v2."]
pub fn get_mut_item<T: 'static, F, R>(mut f: F) -> R
where
F: FnMut(&mut T) -> R,

View File

@ -141,6 +141,7 @@ fn arbiter_drop_no_panic_fut() {
}
#[test]
#[allow(deprecated)]
fn arbiter_item_storage() {
let _ = System::new();