pub struct Observer { /* private fields */ }Expand description
Reads what an Engine played, quantum by quantum.
Built by Engine::observe. An engine has at most
one, so no two readers split its events.
Implementations§
Source§impl Observer
impl Observer
Sourcepub fn read(&mut self) -> Result<Observation, Error>
pub fn read(&mut self) -> Result<Observation, Error>
The totals so far, and the gaps and stalls since the previous read.
Fails once the audio thread found the event queue full, since every count after that would be missing events. Read at least every few seconds to avoid it.
Sourcepub fn finish(&mut self) -> impl Future<Output = ()> + '_
pub fn finish(&mut self) -> impl Future<Output = ()> + '_
End the measurement now, resolving once the next callback, or the stream going away, has closed a gap still open and stopped counting. With no stream it resolves at once. The read after it resolves is final; only the clock moves on.
Dropping the future still ends the measurement; it only stops waiting.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Observer
impl RefUnwindSafe for Observer
impl Send for Observer
impl Sync for Observer
impl Unpin for Observer
impl UnsafeUnpin for Observer
impl UnwindSafe for Observer
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