use full path to helper type
This commit is contained in:
parent
69e172b633
commit
3d12083c16
@ -388,7 +388,7 @@ pub mod heapless_mod {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct UnsafeCellBufWrapper<T> {
|
pub struct UnsafeCellBufWrapper<T> {
|
||||||
val: UnsafeCell<T>,
|
val: UnsafeCell<T>,
|
||||||
once: AtomicBool
|
once: AtomicBool,
|
||||||
}
|
}
|
||||||
// `Sync` is required because `UnsafeCell` is not `Sync` by default.
|
// `Sync` is required because `UnsafeCell` is not `Sync` by default.
|
||||||
// This is safe as long as access is manually synchronized.
|
// This is safe as long as access is manually synchronized.
|
||||||
@ -410,7 +410,10 @@ pub mod heapless_mod {
|
|||||||
/// on T. This API should only be called for declaring byte buffers statically or if T is
|
/// on T. This API should only be called for declaring byte buffers statically or if T is
|
||||||
/// known to be [Sync]. You can use [new] to let the compiler do the [Sync] check.
|
/// known to be [Sync]. You can use [new] to let the compiler do the [Sync] check.
|
||||||
pub const unsafe fn new_unchecked(v: T) -> Self {
|
pub const unsafe fn new_unchecked(v: T) -> Self {
|
||||||
Self { val: UnsafeCell::new(v), once: AtomicBool::new(false) }
|
Self {
|
||||||
|
val: UnsafeCell::new(v),
|
||||||
|
once: AtomicBool::new(false),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves a mutable reference to the internal value once.
|
/// Retrieves a mutable reference to the internal value once.
|
||||||
@ -431,18 +434,18 @@ pub mod heapless_mod {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! static_subpool {
|
macro_rules! static_subpool {
|
||||||
($pool_name: ident, $sizes_list_name: ident, $num_blocks: expr, $block_size: expr) => {
|
($pool_name: ident, $sizes_list_name: ident, $num_blocks: expr, $block_size: expr) => {
|
||||||
static $pool_name: UnsafeCellBufWrapper<[u8; $num_blocks * $block_size]> =
|
static $pool_name: satrs::pool::UnsafeCellBufWrapper<[u8; $num_blocks * $block_size]> =
|
||||||
UnsafeCellBufWrapper::new([0; $num_blocks * $block_size]);
|
satrs::pool::UnsafeCellBufWrapper::new([0; $num_blocks * $block_size]);
|
||||||
static $sizes_list_name: UnsafeCellBufWrapper<[usize; $num_blocks]> =
|
static $sizes_list_name: UnsafeCellBufWrapper<[usize; $num_blocks]> =
|
||||||
UnsafeCellBufWrapper::new([$crate::pool::STORE_FREE; $num_blocks]);
|
satrs::pool::UnsafeCellBufWrapper::new([$crate::pool::STORE_FREE; $num_blocks]);
|
||||||
};
|
};
|
||||||
($pool_name: ident, $sizes_list_name: ident, $num_blocks: expr, $block_size: expr, $meta_data: meta) => {
|
($pool_name: ident, $sizes_list_name: ident, $num_blocks: expr, $block_size: expr, $meta_data: meta) => {
|
||||||
#[$meta_data]
|
#[$meta_data]
|
||||||
static $pool_name: UnsafeCellBufWrapper<[u8; $num_blocks * $block_size]> =
|
static $pool_name: satrs::pool::UnsafeCellBufWrapper<[u8; $num_blocks * $block_size]> =
|
||||||
UnsafeCellBufWrapper::new([0; $num_blocks * $block_size]);
|
satrs::pool::UnsafeCellBufWrapper::new([0; $num_blocks * $block_size]);
|
||||||
#[$meta_data]
|
#[$meta_data]
|
||||||
static $sizes_list_name: UnsafeCellBufWrapper<[usize; $num_blocks]> =
|
static $sizes_list_name: satrs::pool::UnsafeCellBufWrapper<[usize; $num_blocks]> =
|
||||||
UnsafeCellBufWrapper::new([$crate::pool::STORE_FREE; $num_blocks]);
|
satrs::pool::UnsafeCellBufWrapper::new([$crate::pool::STORE_FREE; $num_blocks]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1702,7 +1705,7 @@ mod tests {
|
|||||||
.is_ok());
|
.is_ok());
|
||||||
assert!(heapless_pool
|
assert!(heapless_pool
|
||||||
.grow(
|
.grow(
|
||||||
SUBPOOL_2.get_mut().unwrap(),
|
SUBPOOL_2.get_mut().unwrap(),
|
||||||
SUBPOOL_2_SIZES.get_mut().unwrap(),
|
SUBPOOL_2_SIZES.get_mut().unwrap(),
|
||||||
SUBPOOL_2_NUM_ELEMENTS,
|
SUBPOOL_2_NUM_ELEMENTS,
|
||||||
true
|
true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user