summaryrefslogtreecommitdiffstats
path: root/src/pure.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2022-03-23 17:11:14 +0700
committerLibravatar GitHub <noreply@github.com>2022-03-23 17:11:14 +0700
commit0eef527fa5b04be74141c75b076677473320e321 (patch)
tree5062a9ce2c370632de87a01471526da1176e0a60 /src/pure.rs
parent4aece6b77617f4a37af8208d8ddb1618bf9052d3 (diff)
parentef4c79ea23e86fec9a8ad0fb27463296c14400e5 (diff)
downloadiced-0eef527fa5b04be74141c75b076677473320e321.tar.gz
iced-0eef527fa5b04be74141c75b076677473320e321.tar.bz2
iced-0eef527fa5b04be74141c75b076677473320e321.zip
Merge pull request #1284 from iced-rs/virtual-widgets
Stateless widgets
Diffstat (limited to 'src/pure.rs')
-rw-r--r--src/pure.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/pure.rs b/src/pure.rs
new file mode 100644
index 00000000..948183f1
--- /dev/null
+++ b/src/pure.rs
@@ -0,0 +1,33 @@
+//! 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 mod widget;
+
+mod application;
+mod sandbox;
+
+pub use application::Application;
+pub use sandbox::Sandbox;
+
+pub use iced_pure::helpers::*;
+pub use iced_pure::{Pure, State};
+
+/// A generic, pure [`Widget`].
+pub type Element<'a, Message> =
+ iced_pure::Element<'a, Message, crate::Renderer>;