Merge pull request #290 from AlisCode/aliscode/288/remove-unnecessary-static
Remove unnecessary 'static lifetimes on `Renderer` traits
This commit is contained in:
commit
ce65097834
@ -143,7 +143,7 @@ impl State {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Button<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: self::Renderer,
|
||||
Message: Clone,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
@ -234,7 +234,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Button<'_, (), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.content.hash_layout(state);
|
||||
@ -276,7 +277,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<Button<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: 'a + 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: 'static + self::Renderer + text::Renderer + row::Renderer,
|
||||
Renderer: self::Renderer + text::Renderer + row::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -205,7 +205,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Checkbox<(), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.label.hash(state);
|
||||
}
|
||||
@ -254,7 +255,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<Checkbox<Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer + text::Renderer + row::Renderer,
|
||||
Renderer: 'a + 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: 'static + self::Renderer,
|
||||
Renderer: self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -190,7 +190,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Column<'_, (), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
@ -234,7 +235,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<Column<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: 'a + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -132,7 +132,7 @@ where
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Container<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -203,7 +203,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Container<'_, (), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.padding.hash(state);
|
||||
self.width.hash(state);
|
||||
@ -243,7 +244,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<Container<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: 'a + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -102,7 +102,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Image>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.handle.hash(state);
|
||||
self.width.hash(state);
|
||||
|
@ -356,7 +356,7 @@ pub struct KeyPressEvent {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for PaneGrid<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -597,8 +597,9 @@ where
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
use std::hash::Hash;
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
std::any::TypeId::of::<PaneGrid<'_, (), Renderer>>().hash(state);
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
self.state.hash_layout(state);
|
||||
@ -643,7 +644,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<PaneGrid<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: 'a + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -72,7 +72,7 @@ impl<Renderer: self::Renderer> ProgressBar<Renderer> {
|
||||
|
||||
impl<Message, Renderer> Widget<Message, Renderer> for ProgressBar<Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -114,7 +114,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<ProgressBar<Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
@ -159,7 +160,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<ProgressBar<Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: 'a + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -82,7 +82,7 @@ impl<Message, Renderer: self::Renderer> Radio<Message, Renderer> {
|
||||
|
||||
impl<Message, Renderer> Widget<Message, Renderer> for Radio<Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer + text::Renderer + row::Renderer,
|
||||
Renderer: self::Renderer + text::Renderer + row::Renderer,
|
||||
Message: Clone,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
@ -174,7 +174,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Radio<(), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.label.hash(state);
|
||||
}
|
||||
@ -218,7 +219,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<Radio<Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer + row::Renderer + text::Renderer,
|
||||
Renderer: 'a + 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: 'static + self::Renderer,
|
||||
Renderer: self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -191,7 +191,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Row<'_, (), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.height.hash(state);
|
||||
@ -236,7 +237,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<Row<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: 'a + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(row: Row<'a, Message, Renderer>) -> Element<'a, Message, Renderer> {
|
||||
|
@ -115,7 +115,7 @@ impl<'a, Message, Renderer: self::Renderer> Scrollable<'a, Message, Renderer> {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Scrollable<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer + column::Renderer,
|
||||
Renderer: self::Renderer + column::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
Widget::<Message, Renderer>::width(&self.content)
|
||||
@ -311,7 +311,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Scrollable<'_, (), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.height.hash(state);
|
||||
self.max_height.hash(state);
|
||||
@ -505,7 +506,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<Scrollable<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer + column::Renderer,
|
||||
Renderer: 'a + self::Renderer + column::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -114,7 +114,7 @@ impl State {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for Slider<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: self::Renderer,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
self.width
|
||||
@ -205,7 +205,8 @@ where
|
||||
}
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
std::any::TypeId::of::<Slider<'_, (), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
std::any::TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
}
|
||||
@ -253,7 +254,7 @@ pub trait Renderer: crate::Renderer {
|
||||
impl<'a, Message, Renderer> From<Slider<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: 'a + self::Renderer,
|
||||
Message: 'a,
|
||||
{
|
||||
fn from(
|
||||
|
@ -171,7 +171,7 @@ impl<'a, Message, Renderer: self::Renderer> TextInput<'a, Message, Renderer> {
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer>
|
||||
for TextInput<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: self::Renderer,
|
||||
Message: Clone,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
@ -526,8 +526,8 @@ where
|
||||
|
||||
fn hash_layout(&self, state: &mut Hasher) {
|
||||
use std::{any::TypeId, hash::Hash};
|
||||
|
||||
TypeId::of::<TextInput<'_, (), Renderer>>().hash(state);
|
||||
struct Marker;
|
||||
TypeId::of::<Marker>().hash(state);
|
||||
|
||||
self.width.hash(state);
|
||||
self.max_width.hash(state);
|
||||
@ -632,7 +632,7 @@ pub trait Renderer: crate::Renderer + Sized {
|
||||
impl<'a, Message, Renderer> From<TextInput<'a, Message, Renderer>>
|
||||
for Element<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: 'static + self::Renderer,
|
||||
Renderer: 'a + self::Renderer,
|
||||
Message: 'a + Clone,
|
||||
{
|
||||
fn from(
|
||||
|
Loading…
Reference in New Issue
Block a user