Additional clone removals for wasm
This commit is contained in:
parent
7f9e5765d2
commit
4758e2ff75
@ -15,7 +15,7 @@ pub struct Bus<Message> {
|
|||||||
|
|
||||||
impl<Message> Bus<Message>
|
impl<Message> Bus<Message>
|
||||||
where
|
where
|
||||||
Message: 'static + Clone,
|
Message: 'static,
|
||||||
{
|
{
|
||||||
pub(crate) fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -91,7 +91,7 @@ pub trait Application {
|
|||||||
/// The type of __messages__ your [`Application`] will produce.
|
/// The type of __messages__ your [`Application`] will produce.
|
||||||
///
|
///
|
||||||
/// [`Application`]: trait.Application.html
|
/// [`Application`]: trait.Application.html
|
||||||
type Message: Clone;
|
type Message;
|
||||||
|
|
||||||
/// Initializes the [`Application`].
|
/// Initializes the [`Application`].
|
||||||
///
|
///
|
||||||
@ -148,16 +148,26 @@ pub trait Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
struct Instance<Message> {
|
struct Instance<Message> {
|
||||||
title: String,
|
title: String,
|
||||||
ui: Rc<RefCell<Box<dyn Application<Message = Message>>>>,
|
ui: Rc<RefCell<Box<dyn Application<Message = Message>>>>,
|
||||||
vdom: Rc<RefCell<Option<dodrio::VdomWeak>>>,
|
vdom: Rc<RefCell<Option<dodrio::VdomWeak>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<Message> Clone for Instance<Message> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
title: self.title.clone(),
|
||||||
|
ui: Rc::clone(&self.ui),
|
||||||
|
vdom: Rc::clone(&self.vdom),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<Message> Instance<Message>
|
impl<Message> Instance<Message>
|
||||||
where
|
where
|
||||||
Message: 'static + Clone,
|
Message: 'static
|
||||||
{
|
{
|
||||||
fn new(ui: impl Application<Message = Message> + 'static) -> Self {
|
fn new(ui: impl Application<Message = Message> + 'static) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -221,7 +231,7 @@ where
|
|||||||
|
|
||||||
impl<Message> dodrio::Render for Instance<Message>
|
impl<Message> dodrio::Render for Instance<Message>
|
||||||
where
|
where
|
||||||
Message: 'static + Clone,
|
Message: 'static,
|
||||||
{
|
{
|
||||||
fn render<'a, 'bump>(
|
fn render<'a, 'bump>(
|
||||||
&'a self,
|
&'a self,
|
||||||
|
Loading…
Reference in New Issue
Block a user