Remove hash_layout method from Widget trait

This commit is contained in:
Héctor Ramón Jiménez 2022-02-22 14:10:49 +07:00
parent 9fe5080153
commit 1313c94e3b
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
35 changed files with 105 additions and 636 deletions

View file

@ -4,7 +4,7 @@ use crate::event::{self, Event};
use crate::layout;
use crate::mouse;
use crate::renderer;
use crate::{Clipboard, Hasher, Layout, Point, Rectangle, Shell, Size, Vector};
use crate::{Clipboard, Layout, Point, Rectangle, Shell, Size, Vector};
/// A generic [`Overlay`].
#[allow(missing_debug_implementations)]
@ -100,11 +100,6 @@ where
) {
self.overlay.draw(renderer, style, layout, cursor_position)
}
/// Computes the _layout_ hash of the [`Element`].
pub fn hash_layout(&self, state: &mut Hasher) {
self.overlay.hash_layout(state, self.position);
}
}
struct Map<'a, A, B, Renderer> {
@ -184,8 +179,4 @@ where
) {
self.content.draw(renderer, style, layout, cursor_position)
}
fn hash_layout(&self, state: &mut Hasher, position: Point) {
self.content.hash_layout(state, position);
}
}

View file

@ -10,8 +10,8 @@ use crate::touch;
use crate::widget::scrollable::{self, Scrollable};
use crate::widget::Container;
use crate::{
Clipboard, Color, Element, Hasher, Layout, Length, Padding, Point,
Rectangle, Shell, Size, Vector, Widget,
Clipboard, Color, Element, Layout, Length, Padding, Point, Rectangle,
Shell, Size, Vector, Widget,
};
pub use iced_style::menu::Style;
@ -204,17 +204,6 @@ where
node
}
fn hash_layout(&self, state: &mut Hasher, position: Point) {
use std::hash::Hash;
struct Marker;
std::any::TypeId::of::<Marker>().hash(state);
(position.x as u32).hash(state);
(position.y as u32).hash(state);
self.container.hash_layout(state);
}
fn on_event(
&mut self,
event: Event,
@ -320,17 +309,6 @@ where
layout::Node::new(size)
}
fn hash_layout(&self, state: &mut Hasher) {
use std::hash::Hash as _;
struct Marker;
std::any::TypeId::of::<Marker>().hash(state);
self.options.len().hash(state);
self.text_size.hash(state);
self.padding.hash(state);
}
fn on_event(
&mut self,
event: Event,