Merge MutableAppContext into AppContext

There may have been a good reason for the difference at some point, or I was
still learning Rust. But now it's just &mut AppContext vs &AppContext.
This commit is contained in:
Nathan Sobo
2023-04-06 15:49:03 -06:00
parent dd00966cc6
commit de9bf6dfbd
112 changed files with 882 additions and 1041 deletions
+5 -8
View File
@@ -1,8 +1,8 @@
use serde::Deserialize;
use crate::{
actions, elements::*, impl_actions, AppContext, Entity, MouseButton, MutableAppContext,
RenderContext, View, ViewContext, WeakViewHandle,
actions, elements::*, impl_actions, AppContext, Entity, MouseButton, RenderContext, View,
ViewContext, WeakViewHandle,
};
pub struct Select {
@@ -12,7 +12,7 @@ pub struct Select {
item_count: usize,
is_open: bool,
list_state: UniformListState,
build_style: Option<Box<dyn FnMut(&mut MutableAppContext) -> SelectStyle>>,
build_style: Option<Box<dyn FnMut(&mut AppContext) -> SelectStyle>>,
}
#[derive(Clone, Default)]
@@ -35,7 +35,7 @@ impl_actions!(select, [SelectItem]);
pub enum Event {}
pub fn init(cx: &mut MutableAppContext) {
pub fn init(cx: &mut AppContext) {
cx.add_action(Select::toggle);
cx.add_action(Select::select_item);
}
@@ -57,10 +57,7 @@ impl Select {
}
}
pub fn with_style(
mut self,
f: impl 'static + FnMut(&mut MutableAppContext) -> SelectStyle,
) -> Self {
pub fn with_style(mut self, f: impl 'static + FnMut(&mut AppContext) -> SelectStyle) -> Self {
self.build_style = Some(Box::new(f));
self
}