AUDIO
Source snapshot · 12 October 2026

API reference / ravet_runtime::analytics::AnalyticsQueue

Struct AnalyticsQueue 

pub struct AnalyticsQueue { /* private fields */ }
Expand description

In-memory opt-in queue, disabled initially. Limits: 1..1,024 events and 13..1,048,576 bytes for the complete JSON batch. Overflow rejects the newest event without changing accepted events. Disabling discards all queued data. Enabling must be an explicit consumer action after its own consent decision; RAVET supplies no user-consent UI, collection policy or product endpoint.

Only explicit flush calls the consumer’s sender, synchronously on its worker thread. Failed sends retain the complete batch for an explicit retry; successful sends remove it. Delivery is at-least-once under response loss, not exactly-once. This module never retries, persists or schedules itself. All methods/drop allocate/deallocate or may call blocking consumer code and must stay outside audio callbacks. Exclusive ownership serializes revocation against flush; it cannot retract data already accepted by a sender.

Implementations§

§

impl AnalyticsQueue

pub fn new( maximum_events: usize, maximum_bytes: usize, ) -> Result<Self, AnalyticsError>

pub fn is_enabled(&self) -> bool

pub fn pending(&self) -> usize

pub fn set_enabled(&mut self, enabled: bool)

Explicit consumer opt-in; false also erases pending events immediately.

pub fn record( &mut self, event: AnalyticsEvent, ) -> Result<RecordOutcome, AnalyticsError>

pub fn flush<E>( &mut self, sender: impl FnOnce(&[u8]) -> Result<(), E>, ) -> Result<usize, E>

No sender invocation when disabled or empty. Sender chooses destination, credentials, timeout and what counts as acceptance (e.g. HTTPS 2xx only). A sender error leaves all pending events unchanged; a panic also retains them during unwinding. The batch contains only validated numeric events.

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.