summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Nick Senger <nicks@lich.io>2022-04-18 09:03:17 -0700
committerLibravatar Nick Senger <nicks@lich.io>2022-04-18 09:03:17 -0700
commitb1d6ad00703063d8381dd847361e4684f18c10bd (patch)
tree132ef4a2ebbc2fc08f42b69df2bcf549dbc4dc12
parent2858c8aa681ecd9b2aba6ec4df9ee96d3f50681c (diff)
downloadiced-b1d6ad00703063d8381dd847361e4684f18c10bd.tar.gz
iced-b1d6ad00703063d8381dd847361e4684f18c10bd.tar.bz2
iced-b1d6ad00703063d8381dd847361e4684f18c10bd.zip
Revert "add example"
This reverts commit 11986547cbe772fa0bb863cefc3fff7877d1a6d5.
Diffstat (limited to '')
-rw-r--r--Cargo.toml1
-rw-r--r--examples/pure/stateless_component/Cargo.toml12
-rw-r--r--examples/pure/stateless_component/src/main.rs101
3 files changed, 0 insertions, 114 deletions
diff --git a/Cargo.toml b/Cargo.toml
index b11be495..c6ccc5df 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -93,7 +93,6 @@ members = [
"examples/pure/pick_list",
"examples/pure/todos",
"examples/pure/tour",
- "examples/pure/stateless_component",
"examples/websocket",
]
diff --git a/examples/pure/stateless_component/Cargo.toml b/examples/pure/stateless_component/Cargo.toml
deleted file mode 100644
index d89ebf85..00000000
--- a/examples/pure/stateless_component/Cargo.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-[package]
-name = "stateless_component"
-version = "0.1.0"
-authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
-edition = "2021"
-publish = false
-
-[dependencies]
-iced = { path = "../../..", features = ["debug", "pure"] }
-iced_native = { path = "../../../native" }
-iced_lazy = { path = "../../../lazy", features = ["pure"] }
-iced_pure = { path = "../../../pure" }
diff --git a/examples/pure/stateless_component/src/main.rs b/examples/pure/stateless_component/src/main.rs
deleted file mode 100644
index 066887c9..00000000
--- a/examples/pure/stateless_component/src/main.rs
+++ /dev/null
@@ -1,101 +0,0 @@
-use iced::pure::{button, text};
-use iced::pure::{Element, Sandbox};
-use iced::Settings;
-
-use custom_text::custom_text;
-
-pub fn main() -> iced::Result {
- Mode::run(Settings::default())
-}
-
-enum Mode {
- Standard,
- Custom,
-}
-
-#[derive(Debug, Clone, Copy)]
-enum Message {
- SwitchToComponent,
-}
-
-impl Sandbox for Mode {
- type Message = Message;
-
- fn new() -> Self {
- Self::Standard
- }
-
- fn title(&self) -> String {
- String::from("Stateless Component Bug")
- }
-
- fn update(&mut self, message: Message) {
- match message {
- Message::SwitchToComponent => *self = Mode::Custom,
- }
- }
-
- fn view(&self) -> Element<Message> {
- match self {
- Self::Standard => button(text("Click to Panic"))
- .on_press(Message::SwitchToComponent)
- .into(),
- Self::Custom => button(custom_text("..")).into(),
- }
- }
-}
-
-mod custom_text {
- use iced::pure::text;
- use iced_lazy::pure::{self, Component};
- use iced_native::text;
- use iced_pure::Element;
-
- pub struct CustomText<'a> {
- text: &'a str,
- }
-
- pub fn custom_text<'a>(text: &'a str) -> CustomText<'a> {
- CustomText { text }
- }
-
- #[derive(Debug, Clone)]
- pub enum Event {}
-
- impl<'a> CustomText<'a> {
- pub fn new(text: &'a str) -> Self {
- Self { text }
- }
- }
-
- impl<'a, Message, Renderer> Component<Message, Renderer> for CustomText<'a>
- where
- Renderer: text::Renderer + 'static,
- {
- type State = ();
- type Event = Event;
-
- fn update(
- &mut self,
- _state: &mut Self::State,
- _event: Event,
- ) -> Option<Message> {
- None
- }
-
- fn view(&self, _state: &Self::State) -> Element<Event, Renderer> {
- text(self.text).into()
- }
- }
-
- impl<'a, Message, Renderer> From<CustomText<'a>>
- for Element<'a, Message, Renderer>
- where
- Message: 'a,
- Renderer: 'static + text::Renderer,
- {
- fn from(x: CustomText<'a>) -> Self {
- pure::component(x)
- }
- }
-}