Skip to content

Commit 8cc8cce

Browse files
Merge #326
326: Recover StableDeref trait for pool::object::Object and pool::boxed::Box r=korken89 a=qwerty19106 I add ReadBuffer and WriteBuffer to pool::object::Object and pool::box::Box. It allows to use embedded DMA of HAL crates, such as [stm32f4xx_hal::dma::Transfer](https://docs.rs/stm32f4xx-hal/latest/stm32f4xx_hal/dma/struct.Transfer.html). Co-authored-by: Роман Кривенков <[email protected]>
2 parents f01eb29 + 8a57a69 commit 8cc8cce

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313
- Added an object pool API. see the `pool::object` module level doc for details
1414
- Add `HistoryBuffer::as_slices()`
1515
- Implemented `retain` for `IndexMap` and `IndexSet`.
16+
- Recover `StableDeref` trait for `pool::object::Object` and `pool::boxed::Box`.
1617

1718
### Changed
1819

src/pool/boxed.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ use core::{
8484
ops, ptr,
8585
};
8686

87+
use stable_deref_trait::StableDeref;
88+
8789
use super::treiber::{NonNullPtr, Stack, UnionNode};
8890

8991
/// Creates a new `BoxPool` singleton with the given `$name` that manages the specified `$data_type`
@@ -212,6 +214,8 @@ where
212214
}
213215
}
214216

217+
unsafe impl<P> StableDeref for Box<P> where P: BoxPool {}
218+
215219
impl<A> fmt::Display for Box<A>
216220
where
217221
A: BoxPool,

src/pool/object.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ use core::{
7171
ops, ptr,
7272
};
7373

74+
use stable_deref_trait::StableDeref;
75+
7476
use super::treiber::{AtomicPtr, NonNullPtr, Stack, StructNode};
7577

7678
/// Creates a new `ObjectPool` singleton with the given `$name` that manages the specified
@@ -220,6 +222,8 @@ where
220222
}
221223
}
222224

225+
unsafe impl<A> StableDeref for Object<A> where A: ObjectPool {}
226+
223227
impl<A> fmt::Display for Object<A>
224228
where
225229
A: ObjectPool,

0 commit comments

Comments
 (0)