pub struct BoundedEventSender { /* private fields */ }Expand description
Bounded event sender: item capacity + byte budget (D-015).
Implementations§
Source§impl BoundedEventSender
impl BoundedEventSender
Sourcepub fn new(tx: Sender<QueuedEvent>, max_bytes: usize) -> Self
pub fn new(tx: Sender<QueuedEvent>, max_bytes: usize) -> Self
Wrap an mpsc sender with a shared byte counter.
Sourcepub async fn send(&self, item: QueuedEvent) -> Result<(), EventQueueFull>
pub async fn send(&self, item: QueuedEvent) -> Result<(), EventQueueFull>
Try to enqueue; fails closed when item or byte budget is exceeded.
Byte reservation is cancellation-safe (D-027): if the caller cancels while awaiting item capacity, the Drop guard restores the reserved bytes so a later terminal event can still be queued.
Sourcepub fn byte_counter(&self) -> Arc<AtomicUsize> ⓘ
pub fn byte_counter(&self) -> Arc<AtomicUsize> ⓘ
Shared counter for the delivery task.
Trait Implementations§
Source§impl Clone for BoundedEventSender
impl Clone for BoundedEventSender
Source§fn clone(&self) -> BoundedEventSender
fn clone(&self) -> BoundedEventSender
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BoundedEventSender
impl RefUnwindSafe for BoundedEventSender
impl Send for BoundedEventSender
impl Sync for BoundedEventSender
impl Unpin for BoundedEventSender
impl UnsafeUnpin for BoundedEventSender
impl UnwindSafe for BoundedEventSender
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more