Write docs for subscriptions and reorganize a bit
This commit is contained in:
parent
293314405f
commit
d6c3da21f7
12 changed files with 224 additions and 122 deletions
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ where
|
|||
Command::none()
|
||||
}
|
||||
|
||||
fn subscriptions(&self) -> Subscription<T::Message> {
|
||||
fn subscription(&self) -> Subscription<T::Message> {
|
||||
Subscription::none()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue