pub trait FileWatcherProvider:
Environment
+ Send
+ Sync {
// Required methods
fn RegisterWatcher<'life0, 'async_trait>(
&'life0 self,
Handle: String,
Root: PathBuf,
IsRecursive: bool,
Pattern: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn UnregisterWatcher<'life0, 'async_trait>(
&'life0 self,
Handle: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
An abstract service contract for registering and cancelling recursive filesystem watchers.
Required Methods§
Sourcefn RegisterWatcher<'life0, 'async_trait>(
&'life0 self,
Handle: String,
Root: PathBuf,
IsRecursive: bool,
Pattern: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn RegisterWatcher<'life0, 'async_trait>(
&'life0 self,
Handle: String,
Root: PathBuf,
IsRecursive: bool,
Pattern: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Register a new watcher. Handle is a caller-supplied identifier
(e.g. "watcher:7") that must be echoed back in every emitted event so
the extension host can route events to the right subscriber.
§Parameters
Handle: Caller-supplied watcher identifier.Root: Absolute path of the directory to watch.IsRecursive: Whentrue, observe children recursively.Pattern: Optional glob pattern (e.g.**/*.ts). When present, events whose path does not match the compiled pattern are dropped before crossing the IPC boundary - this is critical for performance under TypeScript-style extensions that register 10+ watchers per activation.
Sourcefn UnregisterWatcher<'life0, 'async_trait>(
&'life0 self,
Handle: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn UnregisterWatcher<'life0, 'async_trait>(
&'life0 self,
Handle: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancel a watcher registered with RegisterWatcher. Unknown handles
resolve to Ok(()) so callers may safely call dispose() without
tracking registration state.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".