pub struct ReQueryObservable { /* private fields */ }Expand description
A re-query based observable that re-executes the query on each change. This leverages the query optimizer and indexes for optimal performance. The physical plan is cached to avoid repeated optimization overhead.
Implementations§
Source§impl ReQueryObservable
impl ReQueryObservable
Sourcepub fn new(
physical_plan: PhysicalPlan,
cache: Rc<RefCell<TableCache>>,
initial_result: Vec<Rc<Row>>,
) -> Self
pub fn new( physical_plan: PhysicalPlan, cache: Rc<RefCell<TableCache>>, initial_result: Vec<Rc<Row>>, ) -> Self
Creates a new re-query observable with a pre-compiled physical plan.
Sourcepub fn subscribe<F: Fn(&[Rc<Row>]) + 'static>(&mut self, callback: F) -> usize
pub fn subscribe<F: Fn(&[Rc<Row>]) + 'static>(&mut self, callback: F) -> usize
Subscribes to changes.
Sourcepub fn unsubscribe(&mut self, id: usize) -> bool
pub fn unsubscribe(&mut self, id: usize) -> bool
Unsubscribes by ID.
Sourcepub fn subscription_count(&self) -> usize
pub fn subscription_count(&self) -> usize
Returns subscription count.
Sourcepub fn on_change(&mut self, changed_ids: &HashSet<u64>)
pub fn on_change(&mut self, changed_ids: &HashSet<u64>)
Called when the table changes - re-executes the cached physical plan. Only notifies subscribers if the result actually changed. Skips re-query entirely if there are no subscribers.
changed_ids contains the row IDs that were modified - used to optimize
comparison by only checking these rows when the result set size is unchanged.
Auto Trait Implementations§
impl Freeze for ReQueryObservable
impl !RefUnwindSafe for ReQueryObservable
impl !Send for ReQueryObservable
impl !Sync for ReQueryObservable
impl Unpin for ReQueryObservable
impl !UnwindSafe for ReQueryObservable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more