Explain Action pattern a bit in The Pocket Guide

This commit is contained in:
Héctor Ramón Jiménez 2024-09-18 22:08:43 +02:00
parent 9e5afc54ce
commit 1ada297b08
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -456,8 +456,16 @@
//! } //! }
//! ``` //! ```
//! //!
//! Functor methods like [`Task::map`], [`Element::map`], and [`Subscription::map`] make this //! The `update` method of a screen can return an `Action` enum that can be leveraged by the parent to
//! approach seamless. //! execute a task or transition to a completely different screen altogether. The variants of `Action` can
//! have associated data. For instance, in the example above, the `Conversation` screen is created when
//! `Contacts::update` returns an `Action::Chat` with the selected contact.
//!
//! Effectively, this approach lets you "tell a story" to connect different screens together in a type safe
//! way.
//!
//! Furthermore, functor methods like [`Task::map`], [`Element::map`], and [`Subscription::map`] make composition
//! seamless.
#![doc( #![doc(
html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/bdf0430880f5c29443f5f0a0ae4895866dfef4c6/docs/logo.svg" html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/bdf0430880f5c29443f5f0a0ae4895866dfef4c6/docs/logo.svg"
)] )]