From 1dd9ef851353c8a51556b715d115dbdade48ec73 Mon Sep 17 00:00:00 2001 From: Daniel Driscoll Date: Thu, 23 Apr 2026 18:50:12 -0700 Subject: [PATCH 1/2] Add ArcBBQueue framed constructors with explicit LenHeader. This restores caller control over frame header width so downstream users can opt into usize-framed queues for payloads larger than 64 KiB. Made-with: Cursor --- bbqueue/src/queue.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bbqueue/src/queue.rs b/bbqueue/src/queue.rs index 6f0eb14..0c111db 100644 --- a/bbqueue/src/queue.rs +++ b/bbqueue/src/queue.rs @@ -145,6 +145,34 @@ impl crate::queue::ArcBBQueue { } } + /// Create a new [`FramedProducer`] for this [`BBQueue`] with a custom + /// frame length header type. + /// + /// This can be used to support large frame sizes by selecting a larger + /// [`LenHeader`] type such as `usize`. + pub fn framed_producer_with_header( + &self, + ) -> FramedProducer>, H> { + FramedProducer { + bbq: self.0.bbq_ref(), + pd: PhantomData, + } + } + + /// Create a new [`FramedConsumer`] for this [`BBQueue`] with a custom + /// frame length header type. + /// + /// This can be used to support large frame sizes by selecting a larger + /// [`LenHeader`] type such as `usize`. + pub fn framed_consumer_with_header( + &self, + ) -> FramedConsumer>, H> { + FramedConsumer { + bbq: self.0.bbq_ref(), + pd: PhantomData, + } + } + /// Create a new [`StreamProducer`] for this [`BBQueue`] /// /// Although mixing stream and framed consumer/producers will not result in UB, From 8840c960a99fe8d8dabd3216dace587a842958fd Mon Sep 17 00:00:00 2001 From: Daniel Driscoll Date: Fri, 24 Apr 2026 08:58:13 -0700 Subject: [PATCH 2/2] add additional doc comments and caveats --- bbqueue/src/queue.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/bbqueue/src/queue.rs b/bbqueue/src/queue.rs index 0c111db..95a055e 100644 --- a/bbqueue/src/queue.rs +++ b/bbqueue/src/queue.rs @@ -149,7 +149,16 @@ impl crate::queue::ArcBBQueue { /// frame length header type. /// /// This can be used to support large frame sizes by selecting a larger - /// [`LenHeader`] type such as `usize`. + /// [`LenHeader`](crate::prod_cons::framed::LenHeader) type such as + /// `usize`. + /// + /// The `H` header type MUST match the `H` used to create the paired + /// [`FramedConsumer`] (typically via + /// [`framed_consumer_with_header`](Self::framed_consumer_with_header)). + /// Header width is not stored in the queue itself, so a mismatch will + /// silently corrupt framing rather than producing a compile-time or + /// runtime error. Mixing framed with stream producers/consumers will not + /// result in UB either, but will also not work correctly. pub fn framed_producer_with_header( &self, ) -> FramedProducer>, H> { @@ -163,7 +172,16 @@ impl crate::queue::ArcBBQueue { /// frame length header type. /// /// This can be used to support large frame sizes by selecting a larger - /// [`LenHeader`] type such as `usize`. + /// [`LenHeader`](crate::prod_cons::framed::LenHeader) type such as + /// `usize`. + /// + /// The `H` header type MUST match the `H` used to create the paired + /// [`FramedProducer`] (typically via + /// [`framed_producer_with_header`](Self::framed_producer_with_header)). + /// Header width is not stored in the queue itself, so a mismatch will + /// silently corrupt framing rather than producing a compile-time or + /// runtime error. Mixing framed with stream producers/consumers will not + /// result in UB either, but will also not work correctly. pub fn framed_consumer_with_header( &self, ) -> FramedConsumer>, H> {