From 99cec352c925cdb2adf6d5257814c4b78ebf4419 Mon Sep 17 00:00:00 2001 From: Daniel Hoffman Date: Thu, 11 Feb 2021 18:03:51 -0600 Subject: [PATCH] update iced from 0.1 to 0.2, move periodic subscription over to the new format --- Cargo.toml | 2 +- src/lib.rs | 31 +------------------------------ 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f450031..3944baf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ authors = ["jazzfool"] edition = "2018" [dependencies] -iced = { version = "0.1", features = ["image", "tokio"] } +iced = { version = "0.2", features = ["image", "tokio"] } iced_native = "0.2" gstreamer = "0.16" gstreamer-app = "0.16" # appsink diff --git a/src/lib.rs b/src/lib.rs index 22070fb..9547954 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -353,36 +353,7 @@ impl VideoPlayer { // until iced 0.2 is released, which has this built-in mod time { - use iced::futures; - pub fn every(duration: std::time::Duration) -> iced::Subscription { - iced::Subscription::from_recipe(Every(duration)) - } - - struct Every(std::time::Duration); - - impl iced_native::subscription::Recipe for Every - where - H: std::hash::Hasher, - { - type Output = std::time::Instant; - - fn hash(&self, state: &mut H) { - use std::hash::Hash; - - std::any::TypeId::of::().hash(state); - self.0.hash(state); - } - - fn stream( - self: Box, - _input: futures::stream::BoxStream<'static, I>, - ) -> futures::stream::BoxStream<'static, Self::Output> { - use futures::stream::StreamExt; - - tokio::time::interval(self.0) - .map(|_| std::time::Instant::now()) - .boxed() - } + iced::time::every(duration) } }