summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/clock.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/examples/clock.rs b/examples/clock.rs
index 5a404bfa..f06762bd 100644
--- a/examples/clock.rs
+++ b/examples/clock.rs
@@ -4,6 +4,8 @@ use iced::{
};
pub fn main() {
+ env_logger::init();
+
Clock::run(Settings::default())
}
@@ -108,30 +110,26 @@ mod time {
>,
}
- impl<Message> iced::subscription::Handle for Tick<Message>
+ impl<Message> iced_native::subscription::Connection for Tick<Message>
where
Message: 'static,
{
+ type Input = iced_native::subscription::Input;
type Output = Message;
fn id(&self) -> u64 {
0
}
- fn stream(&self) -> futures::stream::BoxStream<'static, Message> {
+ fn stream(
+ &self,
+ input: iced_native::subscription::Input,
+ ) -> futures::stream::BoxStream<'static, Message> {
use futures::StreamExt;
- let duration = self.duration.clone();
let function = self.message.clone();
- let stream =
- futures::stream::iter(std::iter::repeat(())).map(move |_| {
- std::thread::sleep(duration);
-
- function(chrono::Local::now())
- });
-
- stream.boxed()
+ input.map(move |_| function(chrono::Local::now())).boxed()
}
}
}