internal: Load VFS config changes in parallel

This commit is contained in:
Lukas Wirth 2024-08-02 12:57:15 +02:00
parent 758ad25229
commit 8286847bee
7 changed files with 128 additions and 80 deletions

View file

@ -43,6 +43,13 @@ pub struct Config {
pub watch: Vec<usize>,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum LoadingProgress {
Started,
Progress(usize),
Finished,
}
/// Message about an action taken by a [`Handle`].
pub enum Message {
/// Indicate a gradual progress.
@ -52,7 +59,7 @@ pub enum Message {
/// The total files to be loaded.
n_total: usize,
/// The files that have been loaded successfully.
n_done: Option<usize>,
n_done: LoadingProgress,
/// The dir being loaded, `None` if its for a file.
dir: Option<AbsPathBuf>,
/// The [`Config`] version.
@ -65,7 +72,7 @@ pub enum Message {
}
/// Type that will receive [`Messages`](Message) from a [`Handle`].
pub type Sender = Box<dyn Fn(Message) + Send>;
pub type Sender = Box<dyn Fn(Message) + Send + Sync>;
/// Interface for reading and watching files.
pub trait Handle: fmt::Debug {