set multiple rsx calls at once to prevent duplicated errors

This commit is contained in:
Evan Almloff committed 2022-06-16 09:11:56 -05:00
1 parent b761bdb767
commit 75e13749ea
3 files changed
+21 -6

No files matched your search

+15
View File
@@ -125,6 +125,17 @@ impl RsxContext {
}
}
/// Set the text for many rsx calls
pub fn extend(&self, msg: SetManyRsxMessage) {
let mut write = self.data.write().unwrap();
for rsx in msg.0 {
write.hm.insert(rsx.location, rsx.new_text);
}
if let Some(channel) = &mut write.scheduler_channel {
channel.unbounded_send(SchedulerMsg::DirtyAll).unwrap()
}
}
fn read(&self) -> RwLockReadGuard<RsxData> {
self.data.read().unwrap()
}
@@ -157,3 +168,7 @@ pub struct SetRsxMessage {
pub location: CodeLocation,
pub new_text: String,
}
/// Set many rsx texts at once to avoid duplicate errors
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct SetManyRsxMessage(pub Vec<SetRsxMessage>);