Skip to content

Commit d8e96a6

Browse files
committed
Strip Generics.
1 parent a7aac49 commit d8e96a6

File tree

3 files changed

+35
-37
lines changed

3 files changed

+35
-37
lines changed

packages/yew/src/html/component/lifecycle.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ impl Runnable for UpdateRunner {
301301
if schedule_render {
302302
scheduler::push_component_render(
303303
state.comp_id,
304-
RenderRunner {
304+
Box::new(RenderRunner {
305305
state: self.state.clone(),
306-
},
306+
}),
307307
);
308308
// Only run from the scheduler, so no need to call `scheduler::start()`
309309
}
@@ -377,9 +377,9 @@ impl RenderRunner {
377377

378378
scheduler::push_component_render(
379379
state.comp_id,
380-
RenderRunner {
380+
Box::new(RenderRunner {
381381
state: shared_state,
382-
},
382+
}),
383383
);
384384
} else {
385385
// We schedule a render after current suspension is resumed.
@@ -393,9 +393,9 @@ impl RenderRunner {
393393
suspension.listen(Callback::from(move |_| {
394394
scheduler::push_component_render(
395395
comp_id,
396-
RenderRunner {
396+
Box::new(RenderRunner {
397397
state: shared_state.clone(),
398-
},
398+
}),
399399
);
400400
scheduler::start();
401401
}));
@@ -442,10 +442,10 @@ impl RenderRunner {
442442

443443
scheduler::push_component_rendered(
444444
state.comp_id,
445-
RenderedRunner {
445+
Box::new(RenderedRunner {
446446
state: self.state.clone(),
447447
first_render,
448-
},
448+
}),
449449
first_render,
450450
);
451451
}

packages/yew/src/html/component/scope.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ mod feat_ssr {
211211

212212
scheduler::push_component_create(
213213
self.id,
214-
CreateRunner {
214+
Box::new(CreateRunner {
215215
initial_render_state: state,
216216
props,
217217
scope: self.clone(),
218-
},
219-
RenderRunner {
218+
}),
219+
Box::new(RenderRunner {
220220
state: self.state.clone(),
221-
},
221+
}),
222222
);
223223
scheduler::start();
224224

@@ -227,12 +227,12 @@ mod feat_ssr {
227227
let self_any_scope = AnyScope::from(self.clone());
228228
html.render_to_string(w, &self_any_scope).await;
229229

230-
scheduler::push_component_destroy(DestroyRunner {
230+
scheduler::push_component_destroy(Box::new(DestroyRunner {
231231
state: self.state.clone(),
232232

233233
#[cfg(feature = "csr")]
234234
parent_to_detach: false,
235-
});
235+
}));
236236
scheduler::start();
237237
}
238238
}
@@ -347,10 +347,10 @@ mod feat_csr_ssr {
347347
}
348348

349349
pub(super) fn push_update(&self, event: UpdateEvent) {
350-
scheduler::push_component_update(UpdateRunner {
350+
scheduler::push_component_update(Box::new(UpdateRunner {
351351
state: self.state.clone(),
352352
event,
353-
});
353+
}));
354354
// Not guaranteed to already have the scheduler started
355355
scheduler::start();
356356
}
@@ -418,14 +418,14 @@ mod feat_csr {
418418

419419
scheduler::push_component_create(
420420
self.id,
421-
CreateRunner {
421+
Box::new(CreateRunner {
422422
initial_render_state: state,
423423
props,
424424
scope: self.clone(),
425-
},
426-
RenderRunner {
425+
}),
426+
Box::new(RenderRunner {
427427
state: self.state.clone(),
428-
},
428+
}),
429429
);
430430
// Not guaranteed to already have the scheduler started
431431
scheduler::start();
@@ -473,10 +473,10 @@ mod feat_csr {
473473

474474
/// Process an event to destroy a component
475475
fn destroy(self, parent_to_detach: bool) {
476-
scheduler::push_component_destroy(DestroyRunner {
476+
scheduler::push_component_destroy(Box::new(DestroyRunner {
477477
state: self.state,
478478
parent_to_detach,
479-
});
479+
}));
480480
// Not guaranteed to already have the scheduler started
481481
scheduler::start();
482482
}
@@ -486,10 +486,10 @@ mod feat_csr {
486486
}
487487

488488
fn shift_node(&self, parent: Element, next_sibling: NodeRef) {
489-
scheduler::push_component_update(UpdateRunner {
489+
scheduler::push_component_update(Box::new(UpdateRunner {
490490
state: self.state.clone(),
491491
event: UpdateEvent::Shift(parent, next_sibling),
492-
})
492+
}))
493493
}
494494
}
495495
}

packages/yew/src/scheduler.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,30 +66,30 @@ mod feat_csr_ssr {
6666
/// Push a component creation, first render and first rendered [Runnable]s to be executed
6767
pub(crate) fn push_component_create(
6868
component_id: usize,
69-
create: impl Runnable + 'static,
70-
first_render: impl Runnable + 'static,
69+
create: Box<dyn Runnable>,
70+
first_render: Box<dyn Runnable>,
7171
) {
7272
with(|s| {
73-
s.create.push(Box::new(create));
74-
s.render_first.insert(component_id, Box::new(first_render));
73+
s.create.push(create);
74+
s.render_first.insert(component_id, first_render);
7575
});
7676
}
7777

7878
/// Push a component destruction [Runnable] to be executed
79-
pub(crate) fn push_component_destroy(runnable: impl Runnable + 'static) {
80-
with(|s| s.destroy.push(Box::new(runnable)));
79+
pub(crate) fn push_component_destroy(runnable: Box<dyn Runnable>) {
80+
with(|s| s.destroy.push(runnable));
8181
}
8282

8383
/// Push a component render and rendered [Runnable]s to be executed
84-
pub(crate) fn push_component_render(component_id: usize, render: impl Runnable + 'static) {
84+
pub(crate) fn push_component_render(component_id: usize, render: Box<dyn Runnable>) {
8585
with(|s| {
86-
s.render.insert(component_id, Box::new(render));
86+
s.render.insert(component_id, render);
8787
});
8888
}
8989

9090
/// Push a component update [Runnable] to be executed
91-
pub(crate) fn push_component_update(runnable: impl Runnable + 'static) {
92-
with(|s| s.update.push(Box::new(runnable)));
91+
pub(crate) fn push_component_update(runnable: Box<dyn Runnable>) {
92+
with(|s| s.update.push(runnable));
9393
}
9494
}
9595

@@ -102,12 +102,10 @@ mod feat_csr {
102102

103103
pub(crate) fn push_component_rendered(
104104
component_id: usize,
105-
rendered: impl Runnable + 'static,
105+
rendered: Box<dyn Runnable>,
106106
first_render: bool,
107107
) {
108108
with(|s| {
109-
let rendered = Box::new(rendered);
110-
111109
if first_render {
112110
s.rendered_first.insert(component_id, rendered);
113111
} else {

0 commit comments

Comments
 (0)