Hash type ids in Widget::hash_layout
impls
This commit is contained in:
parent
0539cd1b85
commit
d07304fb85
@ -143,7 +143,7 @@ impl State {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Button<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: Clone,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
@ -234,6 +234,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Button<'_, (), Renderer>>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.content.hash_layout(state);
|
||||
}
|
||||
@ -274,7 +276,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<Button<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'a + Clone,
|
||||
{
|
||||
fn from(
|
||||
|
@ -110,7 +110,7 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
|
||||
impl<Message, Renderer> Widget<Message, Renderer>
|
||||
for Checkbox<Message, Renderer>
|
||||
where
|
||||
Renderer: self::Renderer + text::Renderer + row::Renderer,
|
||||
Renderer: 'static + self::Renderer + text::Renderer + row::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -205,6 +205,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Checkbox<(), Renderer>>().hash(state);
|
||||
|
||||
self.label.hash(state);
|
||||
}
|
||||
}
|
||||
@ -252,7 +254,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<Checkbox<Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + self::Renderer + text::Renderer + row::Renderer,
|
||||
Renderer: 'static + self::Renderer + text::Renderer + row::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -124,7 +124,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Column<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -190,7 +190,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
0.hash(state);
|
||||
std::any::TypeId::of::<Column<'_, (), Renderer>>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
self.max_width.hash(state);
|
||||
@ -233,7 +234,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<Column<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -122,7 +122,7 @@ where
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Container<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -189,7 +189,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
0.hash(state);
|
||||
std::any::TypeId::of::<Container<'_, (), Renderer>>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
self.max_width.hash(state);
|
||||
@ -227,7 +228,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<Container<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -102,6 +102,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Image>().hash(state);
|
||||
|
||||
self.handle.hash(state);
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
|
@ -80,9 +80,9 @@ pub struct PaneGrid<'a, Message, Renderer> {
|
||||
height: Length,
|
||||
spacing: u16,
|
||||
modifier_keys: keyboard::ModifiersState,
|
||||
on_drag: Option<Box<dyn Fn(DragEvent) -> Message>>,
|
||||
on_resize: Option<Box<dyn Fn(ResizeEvent) -> Message>>,
|
||||
on_key_press: Option<Box<dyn Fn(KeyPressEvent) -> Option<Message>>>,
|
||||
on_drag: Option<Box<dyn Fn(DragEvent) -> Message + 'a>>,
|
||||
on_resize: Option<Box<dyn Fn(ResizeEvent) -> Message + 'a>>,
|
||||
on_key_press: Option<Box<dyn Fn(KeyPressEvent) -> Option<Message> + 'a>>,
|
||||
}
|
||||
|
||||
impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
|
||||
@ -189,7 +189,7 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
|
||||
/// [`PaneGrid`]: struct.PaneGrid.html
|
||||
pub fn on_drag<F>(mut self, f: F) -> Self
|
||||
where
|
||||
F: 'static + Fn(DragEvent) -> Message,
|
||||
F: 'a + Fn(DragEvent) -> Message,
|
||||
{
|
||||
self.on_drag = Some(Box::new(f));
|
||||
self
|
||||
@ -203,7 +203,7 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
|
||||
/// [`PaneGrid`]: struct.PaneGrid.html
|
||||
pub fn on_resize<F>(mut self, f: F) -> Self
|
||||
where
|
||||
F: 'static + Fn(ResizeEvent) -> Message,
|
||||
F: 'a + Fn(ResizeEvent) -> Message,
|
||||
{
|
||||
self.on_resize = Some(Box::new(f));
|
||||
self
|
||||
@ -228,7 +228,7 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
|
||||
/// [`Pane`]: struct.Pane.html
|
||||
pub fn on_key_press<F>(mut self, f: F) -> Self
|
||||
where
|
||||
F: 'static + Fn(KeyPressEvent) -> Option<Message>,
|
||||
F: 'a + Fn(KeyPressEvent) -> Option<Message>,
|
||||
{
|
||||
self.on_key_press = Some(Box::new(f));
|
||||
self
|
||||
@ -349,7 +349,6 @@ impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for PaneGrid<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'static,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -591,7 +590,7 @@ where
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
use std::hash::Hash;
|
||||
|
||||
std::any::TypeId::of::<PaneGrid<'_, Message, Renderer>>().hash(state);
|
||||
std::any::TypeId::of::<PaneGrid<'_, (), Renderer>>().hash(state);
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
self.state.hash_layout(state);
|
||||
@ -637,7 +636,7 @@ impl<'a, Message, Renderer> From<PaneGrid<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'static,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
pane_grid: PaneGrid<'a, Message, Renderer>,
|
||||
|
@ -72,7 +72,7 @@ impl<Renderer: self::Renderer> ProgressBar<Renderer> {
|
||||
|
||||
impl<Message, Renderer> Widget<Message, Renderer> for ProgressBar<Renderer>
|
||||
where
|
||||
Renderer: self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -114,6 +114,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<ProgressBar<Renderer>>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
}
|
||||
@ -157,7 +159,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<ProgressBar<Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -77,7 +77,7 @@ impl<Message, Renderer: self::Renderer> Radio<Message, Renderer> {
|
||||
|
||||
impl<Message, Renderer> Widget<Message, Renderer> for Radio<Message, Renderer>
|
||||
where
|
||||
Renderer: self::Renderer + text::Renderer + row::Renderer,
|
||||
Renderer: 'static + self::Renderer + text::Renderer + row::Renderer,
|
||||
Message: Clone,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
@ -169,6 +169,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Radio<(), Renderer>>().hash(state);
|
||||
|
||||
self.label.hash(state);
|
||||
}
|
||||
}
|
||||
@ -211,7 +213,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<Radio<Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + self::Renderer + row::Renderer + text::Renderer,
|
||||
Renderer: 'static + self::Renderer + row::Renderer + text::Renderer,
|
||||
Message: 'a + Clone,
|
||||
{
|
||||
fn from(radio: Radio<Message, Renderer>) -> Element<'a, Message, Renderer> {
|
||||
|
@ -125,7 +125,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Row<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -191,7 +191,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
1.hash(state);
|
||||
std::any::TypeId::of::<Row<'_, (), Renderer>>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
self.max_width.hash(state);
|
||||
@ -235,7 +236,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<Row<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(row: Row<'a, Message, Renderer>) -> Element<'a, Message, Renderer> {
|
||||
|
@ -311,7 +311,7 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Scrollable<'static, (), Renderer>>().hash(state);
|
||||
std::any::TypeId::of::<Scrollable<'_, (), Renderer>>().hash(state);
|
||||
|
||||
self.height.hash(state);
|
||||
self.max_height.hash(state);
|
||||
|
@ -114,7 +114,7 @@ impl State {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Slider<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -205,6 +205,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Slider<'_, (), Renderer>>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
}
|
||||
}
|
||||
@ -251,7 +253,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<Slider<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'a + self::Renderer,
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -77,6 +77,7 @@ where
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Space>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
}
|
||||
|
@ -99,6 +99,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Svg>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
}
|
||||
|
@ -163,6 +163,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Text>().hash(state);
|
||||
|
||||
self.content.hash(state);
|
||||
self.size.hash(state);
|
||||
self.width.hash(state);
|
||||
|
@ -172,7 +172,7 @@ impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for TextInput<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: Clone + std::fmt::Debug,
|
||||
Message: Clone,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -501,7 +501,7 @@ where
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
use std::{any::TypeId, hash::Hash};
|
||||
|
||||
TypeId::of::<TextInput<'static, (), Renderer>>().hash(state);
|
||||
TypeId::of::<TextInput<'_, (), Renderer>>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.max_width.hash(state);
|
||||
@ -607,7 +607,7 @@ impl<'a, Message, Renderer> From<TextInput<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Message: 'a + Clone + std::fmt::Debug,
|
||||
Message: 'a + Clone,
|
||||
{
|
||||
fn from(
|
||||
text_input: TextInput<'a, Message, Renderer>,
|
||||
|
Loading…
Reference in New Issue
Block a user