Trait rerun::StoreSubscriber

source ·
pub trait StoreSubscriber: Any + Send + Sync {
    // Required methods
    fn name(&self) -> String;
    fn as_any(&self) -> &(dyn Any + 'static);
    fn as_any_mut(&mut self) -> &mut (dyn Any + 'static);
    fn on_events(&mut self, events: &[StoreEvent]);
}
Expand description

Everything needed to build custom StoreSubscribers. A StoreSubscriber subscribes to atomic changes from all DataStores through StoreEvents.

StoreSubscribers can be used to build both secondary indices and trigger systems.

Required Methods§

source

fn name(&self) -> String

Arbitrary name for the subscriber.

Does not need to be unique.

source

fn as_any(&self) -> &(dyn Any + 'static)

Workaround for downcasting support, simply return self:

fn as_any(&self) -> &dyn std::any::Any {
    self
}
source

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Workaround for downcasting support, simply return self:

fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
    self
}
source

fn on_events(&mut self, events: &[StoreEvent])

The core of this trait: get notified of changes happening in all DataStores.

This will be called automatically by the DataStore itself if the subscriber has been registered: DataStore::register_subscriber. Or you might want to feed it StoreEvents manually, depending on your use case.

§Example
fn on_events(&mut self, events: &[StoreEvent]) {
    use re_data_store::StoreDiffKind;
    for event in events {
        match event.kind {
            StoreDiffKind::Addition => println!("Row added: {}", event.row_id),
            StoreDiffKind::Deletion => println!("Row removed: {}", event.row_id),
        }
    }
}

Implementations on Foreign Types§

source§

impl StoreSubscriber for IngestionStatistics

source§

fn name(&self) -> String

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

fn on_events(&mut self, events: &[StoreEvent])

source§

impl StoreSubscriber for EntityTree

source§

fn name(&self) -> String

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

fn on_events(&mut self, _events: &[StoreEvent])

source§

impl StoreSubscriber for TimeHistogramPerTimeline

source§

fn name(&self) -> String

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

fn on_events(&mut self, _events: &[StoreEvent])

source§

impl StoreSubscriber for TimesPerTimeline

source§

fn name(&self) -> String

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

fn on_events(&mut self, events: &[StoreEvent])

Implementors§