summaryrefslogtreecommitdiffstats
path: root/src/time.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/time.rs')
-rw-r--r--src/time.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/time.rs b/src/time.rs
new file mode 100644
index 00000000..b8432895
--- /dev/null
+++ b/src/time.rs
@@ -0,0 +1,12 @@
+//! Listen and react to time.
+use crate::Subscription;
+
+/// Returns a [`Subscription`] that produces messages at a set interval.
+///
+/// The first message is produced after a `duration`, and then continues to
+/// produce more messages every `duration` after that.
+pub fn every(
+ duration: std::time::Duration,
+) -> Subscription<std::time::Instant> {
+ iced_futures::time::every(duration)
+}