summaryrefslogtreecommitdiffstats
path: root/web/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Elliott Mahler <join.together@gmail.com>2020-01-12 19:46:47 -0800
committerLibravatar Elliott Mahler <join.together@gmail.com>2020-01-12 19:46:47 -0800
commit4758e2ff75fc947f0c4a54d8efd87caf4db2afa2 (patch)
treece59087f9f35680eeb9c2264737d704ace5422f3 /web/src/lib.rs
parent7f9e5765d25ce8fad6e8659b02686faee8147d70 (diff)
downloadiced-4758e2ff75fc947f0c4a54d8efd87caf4db2afa2.tar.gz
iced-4758e2ff75fc947f0c4a54d8efd87caf4db2afa2.tar.bz2
iced-4758e2ff75fc947f0c4a54d8efd87caf4db2afa2.zip
Additional clone removals for wasm
Diffstat (limited to 'web/src/lib.rs')
-rw-r--r--web/src/lib.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/web/src/lib.rs b/web/src/lib.rs
index d4c422d2..7ea22e85 100644
--- a/web/src/lib.rs
+++ b/web/src/lib.rs
@@ -91,7 +91,7 @@ pub trait Application {
/// The type of __messages__ your [`Application`] will produce.
///
/// [`Application`]: trait.Application.html
- type Message: Clone;
+ type Message;
/// Initializes the [`Application`].
///
@@ -148,16 +148,26 @@ pub trait Application {
}
}
-#[derive(Clone)]
+
struct Instance<Message> {
title: String,
ui: Rc<RefCell<Box<dyn Application<Message = Message>>>>,
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>
where
- Message: 'static + Clone,
+ Message: 'static
{
fn new(ui: impl Application<Message = Message> + 'static) -> Self {
Self {
@@ -221,7 +231,7 @@ where
impl<Message> dodrio::Render for Instance<Message>
where
- Message: 'static + Clone,
+ Message: 'static,
{
fn render<'a, 'bump>(
&'a self,