refactor: remove not mandatory static lifetime

This commit is contained in:
Théo Gaillard 2020-03-30 06:30:22 +08:00
parent 5b2c71a708
commit 0539cd1b85
No known key found for this signature in database
GPG Key ID: 9C6AAAF893B070FC
13 changed files with 32 additions and 32 deletions

View File

@ -37,16 +37,16 @@ members = [
"web", "web",
"wgpu", "wgpu",
"winit", "winit",
"examples/download_progress",
"examples/bezier_tool", "examples/bezier_tool",
"examples/clock", "examples/clock",
"examples/counter", "examples/counter",
"examples/custom_widget", "examples/custom_widget",
"examples/download_progress",
"examples/events", "examples/events",
"examples/geometry", "examples/geometry",
"examples/integration", "examples/integration",
"examples/pokedex",
"examples/pane_grid", "examples/pane_grid",
"examples/pokedex",
"examples/progress_bar", "examples/progress_bar",
"examples/solar_system", "examples/solar_system",
"examples/stopwatch", "examples/stopwatch",

View File

@ -274,8 +274,8 @@ pub trait Renderer: crate::Renderer + Sized {
impl<'a, Message, Renderer> From<Button<'a, Message, Renderer>> impl<'a, Message, Renderer> From<Button<'a, Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'static + self::Renderer, Renderer: 'a + self::Renderer,
Message: 'static + Clone, Message: 'a + Clone,
{ {
fn from( fn from(
button: Button<'a, Message, Renderer>, button: Button<'a, Message, Renderer>,

View File

@ -252,8 +252,8 @@ pub trait Renderer: crate::Renderer {
impl<'a, Message, Renderer> From<Checkbox<Message, Renderer>> impl<'a, Message, Renderer> From<Checkbox<Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'static + self::Renderer + text::Renderer + row::Renderer, Renderer: 'a + self::Renderer + text::Renderer + row::Renderer,
Message: 'static, Message: 'a,
{ {
fn from( fn from(
checkbox: Checkbox<Message, Renderer>, checkbox: Checkbox<Message, Renderer>,

View File

@ -234,7 +234,7 @@ impl<'a, Message, Renderer> From<Column<'a, Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'a + self::Renderer, Renderer: 'a + self::Renderer,
Message: 'static, Message: 'a,
{ {
fn from( fn from(
column: Column<'a, Message, Renderer>, column: Column<'a, Message, Renderer>,

View File

@ -228,7 +228,7 @@ impl<'a, Message, Renderer> From<Container<'a, Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'a + self::Renderer, Renderer: 'a + self::Renderer,
Message: 'static, Message: 'a,
{ {
fn from( fn from(
column: Container<'a, Message, Renderer>, column: Container<'a, Message, Renderer>,

View File

@ -187,10 +187,10 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
/// Panes can be dragged using `Modifier keys + Left click`. /// Panes can be dragged using `Modifier keys + Left click`.
/// ///
/// [`PaneGrid`]: struct.PaneGrid.html /// [`PaneGrid`]: struct.PaneGrid.html
pub fn on_drag( pub fn on_drag<F>(mut self, f: F) -> Self
mut self, where
f: impl Fn(DragEvent) -> Message + 'static, F: 'static + Fn(DragEvent) -> Message,
) -> Self { {
self.on_drag = Some(Box::new(f)); self.on_drag = Some(Box::new(f));
self self
} }
@ -201,10 +201,10 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
/// Panes can be resized using `Modifier keys + Right click`. /// Panes can be resized using `Modifier keys + Right click`.
/// ///
/// [`PaneGrid`]: struct.PaneGrid.html /// [`PaneGrid`]: struct.PaneGrid.html
pub fn on_resize( pub fn on_resize<F>(mut self, f: F) -> Self
mut self, where
f: impl Fn(ResizeEvent) -> Message + 'static, F: 'static + Fn(ResizeEvent) -> Message,
) -> Self { {
self.on_resize = Some(Box::new(f)); self.on_resize = Some(Box::new(f));
self self
} }
@ -226,10 +226,10 @@ impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> {
/// ///
/// [`PaneGrid`]: struct.PaneGrid.html /// [`PaneGrid`]: struct.PaneGrid.html
/// [`Pane`]: struct.Pane.html /// [`Pane`]: struct.Pane.html
pub fn on_key_press( pub fn on_key_press<F>(mut self, f: F) -> Self
mut self, where
f: impl Fn(KeyPressEvent) -> Option<Message> + 'static, F: 'static + Fn(KeyPressEvent) -> Option<Message>,
) -> Self { {
self.on_key_press = Some(Box::new(f)); self.on_key_press = Some(Box::new(f));
self self
} }
@ -348,7 +348,7 @@ pub struct KeyPressEvent {
impl<'a, Message, Renderer> Widget<Message, Renderer> impl<'a, Message, Renderer> Widget<Message, Renderer>
for PaneGrid<'a, Message, Renderer> for PaneGrid<'a, Message, Renderer>
where where
Renderer: self::Renderer + 'static, Renderer: 'static + self::Renderer,
Message: 'static, Message: 'static,
{ {
fn width(&self) -> Length { fn width(&self) -> Length {
@ -636,7 +636,7 @@ pub trait Renderer: crate::Renderer + Sized {
impl<'a, Message, Renderer> From<PaneGrid<'a, Message, Renderer>> impl<'a, Message, Renderer> From<PaneGrid<'a, Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: self::Renderer + 'static, Renderer: 'static + self::Renderer,
Message: 'static, Message: 'static,
{ {
fn from( fn from(

View File

@ -157,8 +157,8 @@ pub trait Renderer: crate::Renderer {
impl<'a, Message, Renderer> From<ProgressBar<Renderer>> impl<'a, Message, Renderer> From<ProgressBar<Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'static + self::Renderer, Renderer: 'a + self::Renderer,
Message: 'static, Message: 'a,
{ {
fn from( fn from(
progress_bar: ProgressBar<Renderer>, progress_bar: ProgressBar<Renderer>,

View File

@ -211,8 +211,8 @@ pub trait Renderer: crate::Renderer {
impl<'a, Message, Renderer> From<Radio<Message, Renderer>> impl<'a, Message, Renderer> From<Radio<Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'static + self::Renderer + row::Renderer + text::Renderer, Renderer: 'a + self::Renderer + row::Renderer + text::Renderer,
Message: 'static + Clone, Message: 'a + Clone,
{ {
fn from(radio: Radio<Message, Renderer>) -> Element<'a, Message, Renderer> { fn from(radio: Radio<Message, Renderer>) -> Element<'a, Message, Renderer> {
Element::new(radio) Element::new(radio)

View File

@ -236,7 +236,7 @@ impl<'a, Message, Renderer> From<Row<'a, Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'a + self::Renderer, Renderer: 'a + self::Renderer,
Message: 'static, Message: 'a,
{ {
fn from(row: Row<'a, Message, Renderer>) -> Element<'a, Message, Renderer> { fn from(row: Row<'a, Message, Renderer>) -> Element<'a, Message, Renderer> {
Element::new(row) Element::new(row)

View File

@ -506,7 +506,7 @@ impl<'a, Message, Renderer> From<Scrollable<'a, Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'static + self::Renderer + column::Renderer, Renderer: 'static + self::Renderer + column::Renderer,
Message: 'static, Message: 'a,
{ {
fn from( fn from(
scrollable: Scrollable<'a, Message, Renderer>, scrollable: Scrollable<'a, Message, Renderer>,

View File

@ -251,8 +251,8 @@ pub trait Renderer: crate::Renderer {
impl<'a, Message, Renderer> From<Slider<'a, Message, Renderer>> impl<'a, Message, Renderer> From<Slider<'a, Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'static + self::Renderer, Renderer: 'a + self::Renderer,
Message: 'static, Message: 'a,
{ {
fn from( fn from(
slider: Slider<'a, Message, Renderer>, slider: Slider<'a, Message, Renderer>,

View File

@ -97,7 +97,7 @@ pub trait Renderer: crate::Renderer {
impl<'a, Message, Renderer> From<Space> for Element<'a, Message, Renderer> impl<'a, Message, Renderer> From<Space> for Element<'a, Message, Renderer>
where where
Renderer: self::Renderer, Renderer: self::Renderer,
Message: 'static, Message: 'a,
{ {
fn from(space: Space) -> Element<'a, Message, Renderer> { fn from(space: Space) -> Element<'a, Message, Renderer> {
Element::new(space) Element::new(space)

View File

@ -607,7 +607,7 @@ impl<'a, Message, Renderer> From<TextInput<'a, Message, Renderer>>
for Element<'a, Message, Renderer> for Element<'a, Message, Renderer>
where where
Renderer: 'static + self::Renderer, Renderer: 'static + self::Renderer,
Message: 'static + Clone + std::fmt::Debug, Message: 'a + Clone + std::fmt::Debug,
{ {
fn from( fn from(
text_input: TextInput<'a, Message, Renderer>, text_input: TextInput<'a, Message, Renderer>,