Recover StableDeref trait for pool::object::Object and pool::boxed::Box

This commit is contained in:
Роман Кривенков 2022-11-30 14:36:14 +04:00
parent f01eb295d4
commit 8a57a69c9b
3 changed files with 9 additions and 0 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added an object pool API. see the `pool::object` module level doc for details - Added an object pool API. see the `pool::object` module level doc for details
- Add `HistoryBuffer::as_slices()` - Add `HistoryBuffer::as_slices()`
- Implemented `retain` for `IndexMap` and `IndexSet`. - Implemented `retain` for `IndexMap` and `IndexSet`.
- Recover `StableDeref` trait for `pool::object::Object` and `pool::boxed::Box`.
### Changed ### Changed

View File

@ -84,6 +84,8 @@ use core::{
ops, ptr, ops, ptr,
}; };
use stable_deref_trait::StableDeref;
use super::treiber::{NonNullPtr, Stack, UnionNode}; use super::treiber::{NonNullPtr, Stack, UnionNode};
/// Creates a new `BoxPool` singleton with the given `$name` that manages the specified `$data_type` /// Creates a new `BoxPool` singleton with the given `$name` that manages the specified `$data_type`
@ -212,6 +214,8 @@ where
} }
} }
unsafe impl<P> StableDeref for Box<P> where P: BoxPool {}
impl<A> fmt::Display for Box<A> impl<A> fmt::Display for Box<A>
where where
A: BoxPool, A: BoxPool,

View File

@ -71,6 +71,8 @@ use core::{
ops, ptr, ops, ptr,
}; };
use stable_deref_trait::StableDeref;
use super::treiber::{AtomicPtr, NonNullPtr, Stack, StructNode}; use super::treiber::{AtomicPtr, NonNullPtr, Stack, StructNode};
/// Creates a new `ObjectPool` singleton with the given `$name` that manages the specified /// Creates a new `ObjectPool` singleton with the given `$name` that manages the specified
@ -220,6 +222,8 @@ where
} }
} }
unsafe impl<A> StableDeref for Object<A> where A: ObjectPool {}
impl<A> fmt::Display for Object<A> impl<A> fmt::Display for Object<A>
where where
A: ObjectPool, A: ObjectPool,