xilem: Remove lingering `cx` (use `ctx`) (#547)

This commit is contained in:
Bruce Mitchener 2024-08-25 16:41:10 +07:00 committed by GitHub
parent c1732f401e
commit 0914079d0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View File

@ -448,8 +448,8 @@ where
type ViewState = V::ViewState; type ViewState = V::ViewState;
fn build(&self, cx: &mut ViewCtx) -> (Self::Element, Self::ViewState) { fn build(&self, ctx: &mut ViewCtx) -> (Self::Element, Self::ViewState) {
let (pod, state) = self.view.build(cx); let (pod, state) = self.view.build(ctx);
( (
FlexElement::Child(pod.inner.boxed().into(), self.params), FlexElement::Child(pod.inner.boxed().into(), self.params),
state, state,

View File

@ -27,7 +27,7 @@ struct AppInner<State, Fragment: DomFragment<State>, InitFragment> {
fragment_append_scratch: AppendVec<AnyPod>, fragment_append_scratch: AppendVec<AnyPod>,
vec_splice_scratch: Vec<AnyPod>, vec_splice_scratch: Vec<AnyPod>,
elements: Vec<AnyPod>, elements: Vec<AnyPod>,
cx: ViewCtx, ctx: ViewCtx,
} }
pub(crate) trait AppRunner { pub(crate) trait AppRunner {
@ -54,7 +54,7 @@ where
pub fn new(root: impl AsRef<web_sys::Node>, data: State, app_logic: InitFragment) -> Self { pub fn new(root: impl AsRef<web_sys::Node>, data: State, app_logic: InitFragment) -> Self {
let inner = AppInner::new(root.as_ref().clone(), data, app_logic); let inner = AppInner::new(root.as_ref().clone(), data, app_logic);
let app = App(Rc::new(RefCell::new(inner))); let app = App(Rc::new(RefCell::new(inner)));
app.0.borrow_mut().cx.set_runner(app.clone()); app.0.borrow_mut().ctx.set_runner(app.clone());
app app
} }
@ -73,7 +73,7 @@ impl<State, Fragment: DomFragment<State>, InitFragment: FnMut(&mut State) -> Fra
AppInner<State, Fragment, InitFragment> AppInner<State, Fragment, InitFragment>
{ {
pub fn new(root: web_sys::Node, data: State, app_logic: InitFragment) -> Self { pub fn new(root: web_sys::Node, data: State, app_logic: InitFragment) -> Self {
let cx = ViewCtx::default(); let ctx = ViewCtx::default();
AppInner { AppInner {
data, data,
root, root,
@ -81,7 +81,7 @@ impl<State, Fragment: DomFragment<State>, InitFragment: FnMut(&mut State) -> Fra
fragment: None, fragment: None,
fragment_state: None, fragment_state: None,
elements: Vec::new(), elements: Vec::new(),
cx, ctx,
fragment_append_scratch: Default::default(), fragment_append_scratch: Default::default(),
vec_splice_scratch: Default::default(), vec_splice_scratch: Default::default(),
} }
@ -90,7 +90,7 @@ impl<State, Fragment: DomFragment<State>, InitFragment: FnMut(&mut State) -> Fra
fn ensure_app(&mut self) { fn ensure_app(&mut self) {
if self.fragment.is_none() { if self.fragment.is_none() {
let fragment = (self.app_logic)(&mut self.data); let fragment = (self.app_logic)(&mut self.data);
let state = fragment.seq_build(&mut self.cx, &mut self.fragment_append_scratch); let state = fragment.seq_build(&mut self.ctx, &mut self.fragment_append_scratch);
self.fragment = Some(fragment); self.fragment = Some(fragment);
self.fragment_state = Some(state); self.fragment_state = Some(state);
@ -138,7 +138,7 @@ where
&mut inner.elements, &mut inner.elements,
&mut inner.vec_splice_scratch, &mut inner.vec_splice_scratch,
&inner.root, &inner.root,
inner.cx.fragment.clone(), inner.ctx.fragment.clone(),
false, false,
#[cfg(feature = "hydration")] #[cfg(feature = "hydration")]
false, false,
@ -146,7 +146,7 @@ where
new_fragment.seq_rebuild( new_fragment.seq_rebuild(
fragment, fragment,
inner.fragment_state.as_mut().unwrap(), inner.fragment_state.as_mut().unwrap(),
&mut inner.cx, &mut inner.ctx,
&mut dom_children_splice, &mut dom_children_splice,
); );
*fragment = new_fragment; *fragment = new_fragment;