This greatly improves the reliability of path state handling as invalid states are now actively deleted.
TRJASCAZILSAO7KSMCOYZEQPPPPG4YHLMVMFN4AYLY7W7ULHGYOAC // Overwrite the previous path states that were affected, and clear any previous paths// that no longer have an active statelet mut paths_to_remove = Vec::new();for (path, existing_state) in self.states.iter_prefix_mut(prefix) {match updated_states.remove(&path) {Some(updated_state) => {// Update an existing state*existing_state = updated_state;}None => {// There is currently no state attached to this path, so remove itpaths_to_remove.push(path);}}}// Actually clear the paths that no longer have an active state (and aren't untracked)let read_transaction = transaction.read();for outdated_path in paths_to_remove {if read_transaction.is_tracked(&outdated_path)? {self.states.remove(outdated_path);} else {self.states.insert(outdated_path, PathState::Untracked);}}// Insert any new paths that remainfor (path, updated_state) in updated_states {self.states.insert(path, updated_state);}
pub fn iter_path_states(&self) -> impl Iterator<Item = (&Utf8Path, PathState)> {self.path_states.states.iter().map(|(path, state)| (path.as_path(), *state))
pub fn iter_path_states(&self) -> impl Iterator<Item = (Utf8PathBuf, PathState)> {self.path_states.iter_path_states()