pub struct RepoWatcher { /* private fields */ }Expand description
A live watch over a repository, yielding RepoChanges as the repo’s state
changes. Dropping it stops the filesystem watch and the background task.
Implementations§
Source§impl RepoWatcher
impl RepoWatcher
Sourcepub fn builder(repo: impl VcsRepo + 'static) -> Builder
pub fn builder(repo: impl VcsRepo + 'static) -> Builder
A builder over repo (any VcsRepo — e.g. a vcs_core::Repo).
Sourcepub async fn watch(repo: impl VcsRepo + 'static) -> Result<RepoWatcher>
pub async fn watch(repo: impl VcsRepo + 'static) -> Result<RepoWatcher>
Start watching repo with the defaults (state dir only, 250 ms debounce).
Sourcepub async fn recv(&mut self) -> Option<RepoChange>
pub async fn recv(&mut self) -> Option<RepoChange>
Await the next settled change. Returns None once the watcher is dropped
or its background task ends.
Sourcepub fn current(&self) -> &RepoSnapshot
pub fn current(&self) -> &RepoSnapshot
Sourcepub fn stats(&self) -> WatcherStats
pub fn stats(&self) -> WatcherStats
The watcher’s health counters (re-queries run / changes emitted / skips,
what the last skip failed on, and OS-watch errors). Cheap relaxed-atomic
reads — poll it from a health check or log it periodically; a climbing
skipped with flat
changes means the repository is wedged, and a
non-zero watch_errors means the OS watch is
failing (e.g. the watched dir was re-created) — rebuild the watcher.
Trait Implementations§
Source§impl Drop for RepoWatcher
impl Drop for RepoWatcher
Source§impl Stream for RepoWatcher
Available on crate feature stream only.Yields each settled RepoChange as a stream item (the stream feature).
Equivalent to looping recv — both pull from the same
underlying channel (an item is delivered to whichever is polled first, never
duplicated) and both advance current.
impl Stream for RepoWatcher
stream only.Yields each settled RepoChange as a stream item (the stream feature).
Equivalent to looping recv — both pull from the same
underlying channel (an item is delivered to whichever is polled first, never
duplicated) and both advance current.
Source§type Item = RepoChange
type Item = RepoChange
Auto Trait Implementations§
impl Freeze for RepoWatcher
impl RefUnwindSafe for RepoWatcher
impl Send for RepoWatcher
impl Sync for RepoWatcher
impl Unpin for RepoWatcher
impl UnsafeUnpin for RepoWatcher
impl UnwindSafe for RepoWatcher
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<St> StreamExt for St
impl<St> StreamExt for St
Source§fn next(&mut self) -> Next<'_, Self>where
Self: Unpin,
fn next(&mut self) -> Next<'_, Self>where
Self: Unpin,
None if the
stream is finished. Read moreSource§fn try_next<T, E>(&mut self) -> TryNext<'_, Self>
fn try_next<T, E>(&mut self) -> TryNext<'_, Self>
Source§fn map<T, F>(self, f: F) -> Map<Self, F>
fn map<T, F>(self, f: F) -> Map<Self, F>
Source§fn map_while<T, F>(self, f: F) -> MapWhile<Self, F>
fn map_while<T, F>(self, f: F) -> MapWhile<Self, F>
None. Read moreSource§fn then<F, Fut>(self, f: F) -> Then<Self, Fut, F>
fn then<F, Fut>(self, f: F) -> Then<Self, Fut, F>
Source§fn merge<U>(self, other: U) -> Merge<Self, U>
fn merge<U>(self, other: U) -> Merge<Self, U>
Source§fn filter<F>(self, f: F) -> Filter<Self, F>
fn filter<F>(self, f: F) -> Filter<Self, F>
Source§fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
None. Read moreSource§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n items of the underlying stream. Read moreSource§fn take_while<F>(self, f: F) -> TakeWhile<Self, F>
fn take_while<F>(self, f: F) -> TakeWhile<Self, F>
true. Read moreSource§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n first items of the
underlying stream. Read moreSource§fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>
fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>
true. Read moreSource§fn all<F>(&mut self, f: F) -> AllFuture<'_, Self, F>
fn all<F>(&mut self, f: F) -> AllFuture<'_, Self, F>
Source§fn any<F>(&mut self, f: F) -> AnyFuture<'_, Self, F>
fn any<F>(&mut self, f: F) -> AnyFuture<'_, Self, F>
Source§fn chain<U>(self, other: U) -> Chain<Self, U>
fn chain<U>(self, other: U) -> Chain<Self, U>
Source§fn fold<B, F>(self, init: B, f: F) -> FoldFuture<Self, B, F>
fn fold<B, F>(self, init: B, f: F) -> FoldFuture<Self, B, F>
Source§fn collect<T>(
self,
) -> Collect<Self, T, <T as FromStreamPriv<Self::Item>>::InternalCollection>
fn collect<T>( self, ) -> Collect<Self, T, <T as FromStreamPriv<Self::Item>>::InternalCollection>
Source§fn timeout(self, duration: Duration) -> Timeout<Self>where
Self: Sized,
fn timeout(self, duration: Duration) -> Timeout<Self>where
Self: Sized,
time only.Source§fn timeout_repeating(self, interval: Interval) -> TimeoutRepeating<Self>where
Self: Sized,
fn timeout_repeating(self, interval: Interval) -> TimeoutRepeating<Self>where
Self: Sized,
time only.Source§fn throttle(self, duration: Duration) -> Throttle<Self>where
Self: Sized,
fn throttle(self, duration: Duration) -> Throttle<Self>where
Self: Sized,
time only.Source§fn chunks_timeout(
self,
max_size: usize,
duration: Duration,
) -> ChunksTimeout<Self>where
Self: Sized,
fn chunks_timeout(
self,
max_size: usize,
duration: Duration,
) -> ChunksTimeout<Self>where
Self: Sized,
time only.