Skip to main content

AsyncSourceWatch

Struct AsyncSourceWatch 

Source
pub struct AsyncSourceWatch<R: AsyncRuntime, D: SourceDiscovery = Finder> { /* private fields */ }
Expand description

One owned consumer’s cursor over an AsyncFinder’s change generations.

Unlike crate::SourceWatch, this cursor owns its discovery state through an Arc, so it can move across awaits and into spawned tasks. It is Send but not Sync: one consumer advances it through &mut self methods. A failed or dropped operation leaves its generation unchanged. Reports published during a snapshot or an abandoned wait remain owed to the cursor. This also keeps the finder and its runtime alive until the cursor is dropped.

Implementations§

Source§

impl<R: AsyncRuntime, D: SourceDiscovery> AsyncSourceWatch<R, D>

Source

pub async fn current_sources(&mut self) -> Result<Vec<Source>>

Copy current sources and acknowledge the generation read before copying.

Snapshot-lock acquisition can be stopped when this future is dropped; a native snapshot or bounded copy already running finishes. There is no timeout, as with crate::SourceWatch::current_sources.

§Errors

Snapshot, resource and dispatch errors propagate. Failure leaves this cursor unchanged.

Source

pub async fn wait_for_change(&mut self, timeout: Duration) -> Result<bool>

Wait for a report newer than this cursor’s last completed observation.

A zero timeout sees an already published report even while another native waiter is active; otherwise it makes one nonblocking native query. Dropping the future leaves the cursor unchanged. A report consumed by its worker is still published for the next wait and other consumers.

§Errors

Invalid timeouts are refused before submitting work; dispatch failure is crate::Error::SpawnFailed. Failure leaves this cursor unchanged.

Trait Implementations§

Source§

impl<R: AsyncRuntime, D: SourceDiscovery> Debug for AsyncSourceWatch<R, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R, D = Finder> !Freeze for AsyncSourceWatch<R, D>

§

impl<R, D = Finder> !RefUnwindSafe for AsyncSourceWatch<R, D>

§

impl<R, D = Finder> !Sync for AsyncSourceWatch<R, D>

§

impl<R, D> Send for AsyncSourceWatch<R, D>

§

impl<R, D> Unpin for AsyncSourceWatch<R, D>
where R: Unpin,

§

impl<R, D> UnsafeUnpin for AsyncSourceWatch<R, D>

§

impl<R, D> UnwindSafe for AsyncSourceWatch<R, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.