summaryrefslogtreecommitdiffstats
path: root/src/pure.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-02-11 17:51:33 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-02-11 17:51:33 +0700
commit66d69b5c9a183091e05e82bbe21b3203f75c1b18 (patch)
tree949bf0e2d2948d6f405c78b97f26929d3f008f56 /src/pure.rs
parent897188317b5875cc00a0f1c797790df8ac13687f (diff)
downloadiced-66d69b5c9a183091e05e82bbe21b3203f75c1b18.tar.gz
iced-66d69b5c9a183091e05e82bbe21b3203f75c1b18.tar.bz2
iced-66d69b5c9a183091e05e82bbe21b3203f75c1b18.zip
Expose `iced_pure` through a `pure` feature in `iced`
Besides exposing the `iced_pure` crate, enabling the `pure` feature also provides pure versions of both the `Application` and `Sandbox` traits! :tada:
Diffstat (limited to 'src/pure.rs')
-rw-r--r--src/pure.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/pure.rs b/src/pure.rs
new file mode 100644
index 00000000..94d0d2a0
--- /dev/null
+++ b/src/pure.rs
@@ -0,0 +1,29 @@
+//! Leverage pure, virtual widgets in your application.
+//!
+//! The widgets found in this module are completely stateless versions of
+//! [the original widgets].
+//!
+//! Effectively, this means that, as a user of the library, you do not need to
+//! keep track of the local state of each widget (e.g. [`button::State`]).
+//! Instead, the runtime will keep track of everything for you!
+//!
+//! You can embed pure widgets anywhere in your [impure `Application`] using the
+//! [`Pure`] widget and some [`State`].
+//!
+//! In case you want to only use pure widgets in your application, this module
+//! offers an alternate [`Application`] trait with a completely pure `view`
+//! method.
+//!
+//! [the original widgets]: crate::widget
+//! [`button::State`]: crate::widget::button::State
+//! [impure `Application`]: crate::Application
+pub use iced_pure::{Element as _, *};
+
+/// A generic, pure [`Widget`].
+pub type Element<Message> = iced_pure::Element<Message, crate::Renderer>;
+
+mod application;
+mod sandbox;
+
+pub use application::Application;
+pub use sandbox::Sandbox;