Merge pull request #66 from hecrj/feature/new-web-tour

Make `tour` work with `iced_web` again
This commit is contained in:
Héctor Ramón 2019-11-24 19:15:28 +01:00 committed by GitHub
commit bbcd16c335
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 936 additions and 87 deletions

View file

@ -83,7 +83,7 @@ pub trait Application: Sized {
/// The type of __messages__ your [`Application`] will produce.
///
/// [`Application`]: trait.Application.html
type Message: std::fmt::Debug + Send;
type Message: std::fmt::Debug + Send + Clone;
/// Initializes the [`Application`].
///
@ -140,7 +140,7 @@ pub trait Application: Sized {
<Instance<Self> as iced_winit::Application>::run();
#[cfg(target_arch = "wasm32")]
iced_web::Application::run(Instance(self));
<Instance<Self> as iced_web::Application>::run();
}
}
@ -180,11 +180,21 @@ where
{
type Message = A::Message;
fn update(&mut self, message: Self::Message) {
self.0.update(message);
fn new() -> (Self, Command<A::Message>) {
let (app, command) = A::new();
(Instance(app), command)
}
fn view(&mut self) -> Element<Self::Message> {
fn title(&self) -> String {
self.0.title()
}
fn update(&mut self, message: Self::Message) -> Command<Self::Message> {
self.0.update(message)
}
fn view(&mut self) -> Element<'_, Self::Message> {
self.0.view()
}
}

View file

@ -81,7 +81,7 @@ pub trait Sandbox {
/// The type of __messages__ your [`Sandbox`] will produce.
///
/// [`Sandbox`]: trait.Sandbox.html
type Message: std::fmt::Debug + Send;
type Message: std::fmt::Debug + Send + Clone;
/// Initializes the [`Sandbox`].
///