//! Shared accumulation buffer helpers for the windowing and rate operators.
//!
//! Both the leading-edge windowing operators ([`crate::operators::windowing`]) and the
//! trailing-edge rate operators ([`crate::operators::rate`]) accumulate items into a
//! `Vec<T>` bounded by a `max_items` cap and flush it as one window. These
//! helpers keep that buffer discipline in one place so the two families stay
//! consistent instead of each re-deriving the capacity math.
/// Upper bound on the initial `Vec` capacity reserved for an accumulation
/// window, so a very large `max_items` cap does not eagerly allocate a huge
/// buffer up front.
pub const WINDOW_INITIAL_CAPACITY_LIMIT: usize = 1024;
/// Clamp `max_items` to at least one and derive the initial buffer capacity,
/// bounded by [`WINDOW_INITIAL_CAPACITY_LIMIT`].
///
/// Returns `(max_items, initial_capacity)`.
pub
/// Take the accumulated window, leaving a fresh empty buffer sized for the next
/// window in its place.
pub