diff options
author | 2020-01-13 20:28:21 +0100 | |
---|---|---|
committer | 2020-01-13 20:28:21 +0100 | |
commit | 142dc1e9628fba934bdfd83f3fbaf0fbfd852285 (patch) | |
tree | 0da6149ae1c9be912270b74261ad67b906474939 /web/src/lib.rs | |
parent | bad1bab9e894f917e5bfc8bfccfe7763af6d1a67 (diff) | |
parent | 0cbd6668759c8246c5224b5876e7ef0888fe445f (diff) | |
download | iced-142dc1e9628fba934bdfd83f3fbaf0fbfd852285.tar.gz iced-142dc1e9628fba934bdfd83f3fbaf0fbfd852285.tar.bz2 iced-142dc1e9628fba934bdfd83f3fbaf0fbfd852285.zip |
Merge pull request #155 from ejmahler/remove-clone
Remove Clone bound on Application::Message
Diffstat (limited to 'web/src/lib.rs')
-rw-r--r-- | web/src/lib.rs | 18 |
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, |