pub trait ScanExecutor:
Send
+ Sync
+ 'static {
// Required method
fn spawn_blocking(&self, job: ScanJob) -> ScanFuture;
}Expand description
A pluggable executor for blocking scan_dir calls.
Applications that already manage a blocking-task pool can
implement this to route tree expansions through it instead of
spinning up a new std::thread per scan.
Implementors should ensure the returned future resolves once the
job has actually run — cancelling or losing the job will leave
the widget stuck in “loading” forever (is_loaded never flips
to true for the affected directory).
The widget holds the executor behind an Arc, so an impl that
owns any shared state should wrap it in an Arc internally or
store only Send + Sync references.
Required Methods§
Sourcefn spawn_blocking(&self, job: ScanJob) -> ScanFuture
fn spawn_blocking(&self, job: ScanJob) -> ScanFuture
Run job on a blocking-capable worker and return a future
that resolves to its result.
The future is driven from the iced runtime. It must be
Send + 'static — iced spawns tasks across threads.