update for notify 5.0.0-pre.16

This commit is contained in:
trevyn committed 2022-08-15 07:47:19 -04:00
1 parent a853c1fb18
commit 6d9ec38eac
2 files changed
+14 -7

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ toml = "0.5.8"
fs_extra = "1.2.0" fs_extra = "1.2.0"
cargo_toml = "0.11.4" cargo_toml = "0.11.4"
futures = "0.3.21" futures = "0.3.21"
notify = { version = "5.0.0-pre.13", features = ["serde"] } notify = { version = "5.0.0-pre.16", features = ["serde"] }
html_parser = "0.6.2" html_parser = "0.6.2"
binary-install = "0.0.2" binary-install = "0.0.2"
convert_case = "0.5.0" convert_case = "0.5.0"
+13 -6
View File
@@ -98,7 +98,8 @@ pub async fn startup_hot_reload(port: u16, config: CrateConfig) -> Result<()> {
.unwrap_or_else(|| vec![PathBuf::from("src")]); .unwrap_or_else(|| vec![PathBuf::from("src")]);
let watcher_config = config.clone(); let watcher_config = config.clone();
let mut watcher = RecommendedWatcher::new(move |evt: notify::Result<notify::Event>| { let mut watcher = RecommendedWatcher::new(
move |evt: notify::Result<notify::Event>| {
let config = watcher_config.clone(); let config = watcher_config.clone();
if chrono::Local::now().timestamp() > last_update_time { if chrono::Local::now().timestamp() > last_update_time {
// Give time for the change to take effect before reading the file // Give time for the change to take effect before reading the file
@@ -146,8 +147,9 @@ pub async fn startup_hot_reload(port: u16, config: CrateConfig) -> Result<()> {
if let Some(last) = lines.last_mut() { if let Some(last) = lines.last_mut() {
// if there is only one line the start index of last line will be the start of the rsx!, not the start of the line // if there is only one line the start index of last line will be the start of the rsx!, not the start of the line
if start.line == end.line { if start.line == end.line {
*last = *last = last
last.split_at(end.column - start.column).0; .split_at(end.column - start.column)
.0;
} else { } else {
*last = last.split_at(end.column).0; *last = last.split_at(end.column).0;
} }
@@ -191,7 +193,9 @@ pub async fn startup_hot_reload(port: u16, config: CrateConfig) -> Result<()> {
} }
last_update_time = chrono::Local::now().timestamp(); last_update_time = chrono::Local::now().timestamp();
} }
}) },
notify::Config::default(),
)
.unwrap(); .unwrap();
for sub_path in allow_watch_path { for sub_path in allow_watch_path {
@@ -304,7 +308,8 @@ pub async fn startup_default(port: u16, config: CrateConfig) -> Result<()> {
.unwrap_or_else(|| vec![PathBuf::from("src")]); .unwrap_or_else(|| vec![PathBuf::from("src")]);
let watcher_config = config.clone(); let watcher_config = config.clone();
let mut watcher = RecommendedWatcher::new(move |info: notify::Result<notify::Event>| { let mut watcher = RecommendedWatcher::new(
move |info: notify::Result<notify::Event>| {
let config = watcher_config.clone(); let config = watcher_config.clone();
if info.is_ok() { if info.is_ok() {
if chrono::Local::now().timestamp() > last_update_time { if chrono::Local::now().timestamp() > last_update_time {
@@ -325,7 +330,9 @@ pub async fn startup_default(port: u16, config: CrateConfig) -> Result<()> {
} }
} }
} }
}) },
notify::Config::default(),
)
.unwrap(); .unwrap();
for sub_path in allow_watch_path { for sub_path in allow_watch_path {