1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-01-19 00:31:50 +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. /// Insert item into Arbiter's thread-local storage.
/// ///
/// Overwrites any item of the same type previously inserted. /// Overwrites any item of the same type previously inserted.
#[deprecated = "Will be removed in stable v2."]
pub fn set_item<T: 'static>(item: T) { pub fn set_item<T: 'static>(item: T) {
STORAGE.with(move |cell| cell.borrow_mut().insert(TypeId::of::<T>(), Box::new(item))); 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. /// 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 { pub fn contains_item<T: 'static>() -> bool {
STORAGE.with(move |cell| cell.borrow().contains_key(&TypeId::of::<T>())) STORAGE.with(move |cell| cell.borrow().contains_key(&TypeId::of::<T>()))
} }
@ -231,6 +233,7 @@ impl Arbiter {
/// ///
/// # Panics /// # Panics
/// Panics if item is not in Arbiter's thread-local item storage. /// 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 pub fn get_item<T: 'static, F, R>(mut f: F) -> R
where where
F: FnMut(&T) -> R, F: FnMut(&T) -> R,
@ -249,6 +252,7 @@ impl Arbiter {
/// ///
/// # Panics /// # Panics
/// Panics if item is not in Arbiter's thread-local item storage. /// 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 pub fn get_mut_item<T: 'static, F, R>(mut f: F) -> R
where where
F: FnMut(&mut T) -> R, F: FnMut(&mut T) -> R,

View File

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