Add elided lifetimes to view helpers in examples
This commit is contained in:
parent
bde4572bc5
commit
5ca5000cdc
50 changed files with 95 additions and 84 deletions
|
|
@ -68,7 +68,7 @@ impl Layout {
|
|||
})
|
||||
}
|
||||
|
||||
fn view(&self) -> Element<Message> {
|
||||
fn view(&self) -> Element<'_, Message> {
|
||||
let header = row![
|
||||
text(self.example.title).size(20).font(Font::MONOSPACE),
|
||||
horizontal_space(),
|
||||
|
|
@ -121,7 +121,7 @@ impl Layout {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Copy, Eq)]
|
||||
struct Example {
|
||||
title: &'static str,
|
||||
view: fn() -> Element<'static, Message>,
|
||||
|
|
@ -190,7 +190,7 @@ impl Example {
|
|||
Self::LIST.get(index + 1).copied().unwrap_or(self)
|
||||
}
|
||||
|
||||
fn view(&self) -> Element<Message> {
|
||||
fn view(&self) -> Element<'_, Message> {
|
||||
(self.view)()
|
||||
}
|
||||
}
|
||||
|
|
@ -201,6 +201,12 @@ impl Default for Example {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialEq for Example {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.title == other.title
|
||||
}
|
||||
}
|
||||
|
||||
fn centered<'a>() -> Element<'a, Message> {
|
||||
center(text("I am centered!").size(50)).into()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue