Trait WatcherHandler

Source
pub trait WatcherHandler {
    // Required methods
    async fn on_snapshot(
        &self,
        snapshot: Snapshot,
        state: State,
    ) -> Result<(), Error>;
    async fn on_error(&self, error: Error);
}
Expand description

A simple file watcher that monitors changes in a list of files and triggers appropriate handlers.

Required Methods§

Source

async fn on_snapshot( &self, snapshot: Snapshot, state: State, ) -> Result<(), Error>

Defines how the snapshot should be uploaded or processed.

§Parameters
  • snapshot: A snapshot of the monitored files, containing file metadata and content.
§Returns
  • Ok(()) if processing is successful.
  • Err(Error) if an error occurs while processing the snapshot.
Source

async fn on_error(&self, error: Error)

Handles errors that occur during file monitoring.

§Parameters
  • error: The error encountered during monitoring.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§