pub struct ValueCollector { /* private fields */ }Expand description
Collector for subscription values with thread-safe access
Implementations§
Source§impl ValueCollector
impl ValueCollector
pub fn new() -> Self
Sourcepub fn callback(&self) -> impl Fn(Value, String) + Send + 'static
pub fn callback(&self) -> impl Fn(Value, String) + Send + 'static
Create a callback function for subscriptions
Sourcepub fn callback_ref(&self) -> impl Fn(Value, &str) + Send + Sync + 'static
pub fn callback_ref(&self) -> impl Fn(Value, &str) + Send + Sync + 'static
Create a callback function for subscriptions that takes &str address
Sourcepub async fn wait_for_count(&self, n: u32, max_wait: Duration) -> bool
pub async fn wait_for_count(&self, n: u32, max_wait: Duration) -> bool
Wait for at least n values to be received
Sourcepub fn has_address(&self, addr: &str) -> bool
pub fn has_address(&self, addr: &str) -> bool
Check if a specific address was received
Sourcepub fn values_for(&self, addr: &str) -> Vec<Value>
pub fn values_for(&self, addr: &str) -> Vec<Value>
Get values for a specific address pattern
Sourcepub fn last_value(&self) -> Option<(String, Value)>
pub fn last_value(&self) -> Option<(String, Value)>
Get the last value received
Trait Implementations§
Source§impl Clone for ValueCollector
impl Clone for ValueCollector
Source§fn clone(&self) -> ValueCollector
fn clone(&self) -> ValueCollector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ValueCollector
impl !RefUnwindSafe for ValueCollector
impl Send for ValueCollector
impl Sync for ValueCollector
impl Unpin for ValueCollector
impl !UnwindSafe for ValueCollector
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