From 10c2cc14894a83564b95e7fc773ffc889343c8f6 Mon Sep 17 00:00:00 2001 From: Zeeshan Ali Khan Date: Sat, 23 Aug 2025 14:35:55 +0200 Subject: [PATCH] Allow setting visibility of the pool struct in the `box_pool!` macro --- CHANGELOG.md | 1 + src/pool/boxed.rs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23e59a81fc..20b0bb8544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - Make MSRV of 1.87.0 explicit. +- Allow setting visibility for the pool struct in the `box_pool!` macro. ## [v0.9.1] - 2025-08-19 diff --git a/src/pool/boxed.rs b/src/pool/boxed.rs index bd3b6ae737..10730f88f2 100644 --- a/src/pool/boxed.rs +++ b/src/pool/boxed.rs @@ -64,7 +64,8 @@ //! use core::ptr::addr_of_mut; //! use heapless::{box_pool, pool::boxed::BoxBlock}; //! -//! box_pool!(MyBoxPool: u128); +//! // You can optionally set visibility for the pool struct. +//! box_pool!(pub MyBoxPool: u128); //! //! const POOL_CAPACITY: usize = 8; //! @@ -96,8 +97,8 @@ use super::treiber::{NonNullPtr, Stack, UnionNode}; /// For more extensive documentation see the [module level documentation](crate::pool::boxed) #[macro_export] macro_rules! box_pool { - ($name:ident: $data_type:ty) => { - pub struct $name; + ($visibility:vis $name:ident: $data_type:ty) => { + $visibility struct $name; impl $crate::pool::boxed::BoxPool for $name { type Data = $data_type;