From 35e9b75e415ef3b9124051696b60628ef56afe47 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 16 Feb 2022 15:44:50 +0700 Subject: Introduce `Tag` and `State` opaque types in `iced_pure::widget::tree` --- pure/src/widget/text_input.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'pure/src/widget/text_input.rs') diff --git a/pure/src/widget/text_input.rs b/pure/src/widget/text_input.rs index e18a2bf0..40ce140c 100644 --- a/pure/src/widget/text_input.rs +++ b/pure/src/widget/text_input.rs @@ -1,4 +1,5 @@ -use crate::widget::{Element, Tree, Widget}; +use crate::widget::tree::{self, Tree}; +use crate::widget::{Element, Widget}; use iced_native::event::{self, Event}; use iced_native::layout::{self, Layout}; @@ -12,8 +13,6 @@ use iced_native::{ pub use iced_style::text_input::StyleSheet; -use std::any::{self, Any}; - /// A field that can be filled with text. /// /// # Example @@ -138,18 +137,12 @@ where Message: Clone, Renderer: iced_native::text::Renderer, { - fn tag(&self) -> any::TypeId { - any::TypeId::of::() - } - - fn state(&self) -> Box { - Box::new(text_input::State::new()) + fn tag(&self) -> tree::Tag { + tree::Tag::of::() } - fn diff(&self, _tree: &mut Tree) {} - - fn children_state(&self) -> Vec { - Vec::new() + fn state(&self) -> tree::State { + tree::State::new(text_input::State::new()) } fn width(&self) -> Length { -- cgit