summaryrefslogtreecommitdiffstats
path: root/src/application.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-14 05:56:46 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-14 05:56:46 +0100
commitd6c3da21f7fe7a79bcfbc2a180dc111e42300a04 (patch)
treebbe8e02712824cd0fe22028bd3072fbfce104d62 /src/application.rs
parent293314405f5b8d4003db5ef8f428e659ae36872d (diff)
downloadiced-d6c3da21f7fe7a79bcfbc2a180dc111e42300a04.tar.gz
iced-d6c3da21f7fe7a79bcfbc2a180dc111e42300a04.tar.bz2
iced-d6c3da21f7fe7a79bcfbc2a180dc111e42300a04.zip
Write docs for subscriptions and reorganize a bit
Diffstat (limited to 'src/application.rs')
-rw-r--r--src/application.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/application.rs b/src/application.rs
index 95113344..98e160ce 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -117,8 +117,17 @@ pub trait Application: Sized {
/// [`Command`]: struct.Command.html
fn update(&mut self, message: Self::Message) -> Command<Self::Message>;
- /// TODO
- fn subscriptions(&self) -> Subscription<Self::Message> {
+ /// Returns the event [`Subscription`] for the current state of the
+ /// application.
+ ///
+ /// A [`Subscription`] will be kept alive as long as you keep returning it,
+ /// and the __messages__ produced will be handled by
+ /// [`update`](#tymethod.update).
+ ///
+ /// By default, this method returns an empty [`Subscription`].
+ ///
+ /// [`Subscription`]: struct.Subscription.html
+ fn subscription(&self) -> Subscription<Self::Message> {
Subscription::none()
}
@@ -173,8 +182,8 @@ where
self.0.update(message)
}
- fn subscriptions(&self) -> Subscription<Self::Message> {
- self.0.subscriptions()
+ fn subscription(&self) -> Subscription<Self::Message> {
+ self.0.subscription()
}
fn view(&mut self) -> Element<'_, Self::Message> {