Trait re_chunk_store::ChunkStoreSubscriber
source · pub trait ChunkStoreSubscriber: Any + Send + Sync {
// Required methods
fn name(&self) -> String;
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
fn on_events(&mut self, events: &[ChunkStoreEvent]);
}
Expand description
A ChunkStoreSubscriber
subscribes to atomic changes from all ChunkStore
s
through ChunkStoreEvent
s.
ChunkStoreSubscriber
s can be used to build both secondary indices and trigger systems.
Required Methods§
sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Workaround for downcasting support, simply return self
:
ⓘ
fn as_any(&self) -> &dyn std::any::Any {
self
}
sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Workaround for downcasting support, simply return self
:
ⓘ
fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
self
}
sourcefn on_events(&mut self, events: &[ChunkStoreEvent])
fn on_events(&mut self, events: &[ChunkStoreEvent])
The core of this trait: get notified of changes happening in all ChunkStore
s.
This will be called automatically by the ChunkStore
itself if the subscriber has been
registered: ChunkStore::register_subscriber
.
Or you might want to feed it ChunkStoreEvent
s manually, depending on your use case.
§Example
ⓘ
fn on_events(&mut self, events: &[ChunkStoreEvent]) {
use re_chunk_store::ChunkStoreDiffKind;
for event in events {
match event.kind {
ChunkStoreDiffKind::Addition => println!("Row added: {}", event.row_id),
ChunkStoreDiffKind::Deletion => println!("Row removed: {}", event.row_id),
}
}
}