Skip to main content

Consumer

Trait Consumer 

Source
pub trait Consumer: Send + Sync {
    // Required methods
    fn add(&self, data: &Data) -> Result<()>;
    fn flush(&self) -> Result<()>;
    fn close(&self) -> Result<()>;

    // Provided method
    fn is_stringent(&self) -> bool { ... }
}
Expand description

Synchronous delivery interface implemented by all consumers.

This is the Rust counterpart of the Go SDK’s TDConsumer interface: the TDAnalytics facade validates and builds events, then delegates delivery to a consumer. Available with the blocking feature.

Required Methods§

Source

fn add(&self, data: &Data) -> Result<()>

Deliver one event. Called with an already validated snapshot.

Source

fn flush(&self) -> Result<()>

Deliver everything currently buffered.

Source

fn close(&self) -> Result<()>

Flush, release resources and stop accepting new events. Repeated calls return the same result.

Provided Methods§

Source

fn is_stringent(&self) -> bool

Whether this consumer validates property keys strictly. Only the debug consumer is stringent.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<C: Consumer + ?Sized> Consumer for Arc<C>

Available on crate feature blocking only.
Source§

fn add(&self, data: &Data) -> Result<()>

Source§

fn flush(&self) -> Result<()>

Source§

fn close(&self) -> Result<()>

Source§

fn is_stringent(&self) -> bool

Source§

impl<C: Consumer + ?Sized> Consumer for Box<C>

Available on crate feature blocking only.
Source§

fn add(&self, data: &Data) -> Result<()>

Source§

fn flush(&self) -> Result<()>

Source§

fn close(&self) -> Result<()>

Source§

fn is_stringent(&self) -> bool

Implementors§

Source§

impl Consumer for BatchConsumer

Available on crate feature blocking only.
Source§

impl Consumer for DebugConsumer

Available on crate feature blocking only.
Source§

impl Consumer for LogConsumer

Available on crate feature blocking only.