on master help sign in
Use `'a` lifetimes instead of `'bump`
2ef0923Nick Fitzgerald
README.md+4−6
@@ -31,12 +31,10 @@ struct Hello {
31}
31}
32
32
33impl Render for Hello {
33impl Render for Hello {
34− fn render<'a, 'bump>(&'a self, cx: &mut RenderContext<'bump>) -> Node<'bump>
34+ fn render<'a>(&self, cx: &mut RenderContext<a>) -> Node<'a> {
35− where
35+ let who = bumpalo::format!(in cx.bump, "Hello, {}!", self.who);
36− 'a: 'bump,
36+ div(cx)
37− {
38− span(cx)
39− .children([text("Hello, "), text(&self.who), text("!")])
37+ .children([text(who.into_bump_str())])
40 .finish()
38 .finish()
41 }
39 }
42}
40}
benches/benches.rs+2−2
@@ -17,7 +17,7 @@ use std::cell::RefCell;
17/// The simplest thing we can render: `<div/>`.
17/// The simplest thing we can render: `<div/>`.
18struct Empty;
18struct Empty;
19impl Render for Empty {
19impl Render for Empty {
20− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
20+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
21 div(&cx).finish()
21 div(&cx).finish()
22 }
22 }
23}
23}
@@ -25,7 +25,7 @@ impl Render for Empty {
25/// Render a list that is `self.0` items long, has attributes and listeners.
25/// Render a list that is `self.0` items long, has attributes and listeners.
26struct SimpleList(usize);
26struct SimpleList(usize);
27impl Render for SimpleList {
27impl Render for SimpleList {
28− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
28+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
29 let mut children = bumpalo::collections::Vec::with_capacity_in(self.0, cx.bump);
29 let mut children = bumpalo::collections::Vec::with_capacity_in(self.0, cx.bump);
30 children.extend((0..self.0).map(|_| {
30 children.extend((0..self.0).map(|_| {
31 li(&cx)
31 li(&cx)
crates/js-api/src/lib.rs+3−3
@@ -100,7 +100,7 @@ impl GreetingViaJs {
100/// And finally the `Render` implementation! This adds a `<p>` element and some
100/// And finally the `Render` implementation! This adds a `<p>` element and some
101/// text around whatever the inner JS `Greeting` component renders.
101/// text around whatever the inner JS `Greeting` component renders.
102impl Render for GreetingViaJs {
102impl Render for GreetingViaJs {
103− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
103+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
104 use dodrio::builder::*;
104 use dodrio::builder::*;
105 p(&cx)
105 p(&cx)
106 .children([
106 .children([
@@ -214,7 +214,7 @@ impl JsRender {
214}
214}
215
215
216impl Render for JsRender {
216impl Render for JsRender {
217− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
217+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
218 create(cx, self.render())
218 create(cx, self.render())
219 }
219 }
220}
220}
@@ -223,7 +223,7 @@ fn has_property(obj: &Object, property: &str) -> bool {
223 Reflect::has(obj, &property.into()).unwrap_or_default()
223 Reflect::has(obj, &property.into()).unwrap_or_default()
224}
224}
225
225
226−fn create<'bump>(cx: &mut RenderContext<'bump>, val: JsValue) -> Node<'bump> {
226+fn create<'a>(cx: &mut RenderContext<'a>, val: JsValue) -> Node<'a> {
227 if let Some(txt) = val.as_string() {
227 if let Some(txt) = val.as_string() {
228 let text = bumpalo::collections::String::from_str_in(&txt, cx.bump);
228 let text = bumpalo::collections::String::from_str_in(&txt, cx.bump);
229 return builder::text(text.into_bump_str());
229 return builder::text(text.into_bump_str());
examples/counter/src/lib.rs+1−1
@@ -27,7 +27,7 @@ impl Counter {
27// The `Render` implementation for `Counter`s displays the current count and has
27// The `Render` implementation for `Counter`s displays the current count and has
28// buttons to increment and decrement the count.
28// buttons to increment and decrement the count.
29impl Render for Counter {
29impl Render for Counter {
30− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> dodrio::Node<'bump> {
30+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> dodrio::Node<'a> {
31 use dodrio::builder::*;
31 use dodrio::builder::*;
32
32
33 // Stringify the count as a bump-allocated string.
33 // Stringify the count as a bump-allocated string.
examples/game-of-life/src/lib.rs+1−1
@@ -128,7 +128,7 @@ impl Universe {
128
128
129/// The rendering implementation for our Game of Life.
129/// The rendering implementation for our Game of Life.
130impl Render for Universe {
130impl Render for Universe {
131− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
131+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
132 use dodrio::builder::*;
132 use dodrio::builder::*;
133
133
134 let mut rows = bumpalo::collections::Vec::with_capacity_in(self.height as usize, cx.bump);
134 let mut rows = bumpalo::collections::Vec::with_capacity_in(self.height as usize, cx.bump);
examples/hello-world/src/lib.rs+1−1
@@ -11,7 +11,7 @@ struct Hello {
11// The `Render` implementation describes how to render a `Hello` component into
11// The `Render` implementation describes how to render a `Hello` component into
12// HTML.
12// HTML.
13impl Render for Hello {
13impl Render for Hello {
14− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
14+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
15 let msg = bumpalo::format!(in cx.bump, "Hello, {}!", self.who);
15 let msg = bumpalo::format!(in cx.bump, "Hello, {}!", self.who);
16 let msg = msg.into_bump_str();
16 let msg = msg.into_bump_str();
17 p(&cx).children([text(msg)]).finish()
17 p(&cx).children([text(msg)]).finish()
examples/input-form/src/lib.rs+1−1
@@ -24,7 +24,7 @@ impl SayHelloTo {
24// The `Render` implementation has a text `<input>` and a `<div>` that shows a
24// The `Render` implementation has a text `<input>` and a `<div>` that shows a
25// greeting to the `<input>`'s value.
25// greeting to the `<input>`'s value.
26impl Render for SayHelloTo {
26impl Render for SayHelloTo {
27− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
27+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
28 use dodrio::builder::*;
28 use dodrio::builder::*;
29
29
30 div(&cx)
30 div(&cx)
examples/js-component/src/lib.rs+1−1
@@ -32,7 +32,7 @@ impl GreetingViaJs {
32/// Here's the `Render` implementation! This adds a `<p>` element and some text
32/// Here's the `Render` implementation! This adds a `<p>` element and some text
33/// around whatever the inner JS `Greeting` component renders.
33/// around whatever the inner JS `Greeting` component renders.
34impl Render for GreetingViaJs {
34impl Render for GreetingViaJs {
35− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
35+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
36 use dodrio::builder::*;
36 use dodrio::builder::*;
37 p(&cx)
37 p(&cx)
38 .children([text("JavaScript says: "), self.js.render(cx)])
38 .children([text("JavaScript says: "), self.js.render(cx)])
examples/moire/src/lib.rs+13−22
@@ -106,7 +106,7 @@ impl Moire {
106}
106}
107
107
108impl Render for Moire {
108impl Render for Moire {
109− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
109+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
110 use dodrio::builder::*;
110 use dodrio::builder::*;
111
111
112 let elapsed = web_sys::window()
112 let elapsed = web_sys::window()
@@ -150,7 +150,7 @@ impl Render for Moire {
150/// Rendering helper methods.
150/// Rendering helper methods.
151impl Moire {
151impl Moire {
152 /// Generate the main Moire element's inline CSS styles.
152 /// Generate the main Moire element's inline CSS styles.
153− fn moire_style<'bump>(&self, cx: &mut RenderContext<'bump>, elapsed: f64) -> &'bump str {
153+ fn moire_style<'a>(&self, cx: &mut RenderContext<'a>, elapsed: f64) -> &'a str {
154 let elapsed = elapsed / 3.0;
154 let elapsed = elapsed / 3.0;
155 let color = colors::get_interpolated_color(|(_, bg)| bg, elapsed % 1.0);
155 let color = colors::get_interpolated_color(|(_, bg)| bg, elapsed % 1.0);
156 let style = bumpalo::format!(
156 let style = bumpalo::format!(
@@ -164,7 +164,7 @@ impl Moire {
164 }
164 }
165
165
166 /// Generate the orbiting circle objects.
166 /// Generate the orbiting circle objects.
167− fn orbiting_objects<'bump>(&self, cx: &mut RenderContext<'bump>, elapsed: f64) -> Node<'bump> {
167+ fn orbiting_objects<'a>(&self, cx: &mut RenderContext<'a>, elapsed: f64) -> Node<'a> {
168 const D: f64 = 200.0;
168 const D: f64 = 200.0;
169 let x = elapsed.sin() * D;
169 let x = elapsed.sin() * D;
170 let y = elapsed.cos() * D;
170 let y = elapsed.cos() * D;
@@ -173,24 +173,20 @@ impl Moire {
173
173
174 /// Generate the lemniscate circle objects that interact with the orbiting
174 /// Generate the lemniscate circle objects that interact with the orbiting
175 /// circle objects to form Moire patterns.
175 /// circle objects to form Moire patterns.
176− fn lemniscate_objects<'bump>(
176+ fn lemniscate_objects<'a>(&self, cx: &mut RenderContext<'a>, elapsed: f64) -> Node<'a> {
177− &self,
178− cx: &mut RenderContext<'bump>,
179− elapsed: f64,
180− ) -> Node<'bump> {
181 const A: f64 = 150.0;
177 const A: f64 = 150.0;
182 let x = elapsed.sin() * A;
178 let x = elapsed.sin() * A;
183 let y = elapsed.sin() * elapsed.cos() * A;
179 let y = elapsed.sin() * elapsed.cos() * A;
184 self.moving_object(cx, elapsed, x, y)
180 self.moving_object(cx, elapsed, x, y)
185 }
181 }
186
182
187− fn moving_object<'a, 'bump>(
183+ fn moving_object<'a>(
188− &'a self,
184+ &self,
189− cx: &mut RenderContext<'bump>,
185+ cx: &mut RenderContext<'a>,
190 elapsed: f64,
186 elapsed: f64,
191 x: f64,
187 x: f64,
192 y: f64,
188 y: f64,
193− ) -> Node<'bump> {
189+ ) -> Node<'a> {
194 use dodrio::builder::*;
190 use dodrio::builder::*;
195 div(&cx)
191 div(&cx)
196 .attr("class", "object")
192 .attr("class", "object")
@@ -200,17 +196,12 @@ impl Moire {
200 }
196 }
201
197
202 /// Generate inline CSS styles for a moving object.
198 /// Generate inline CSS styles for a moving object.
203− fn moving_object_style<'bump>(
199+ fn moving_object_style<'a>(&self, cx: &mut RenderContext<'a>, x: f64, y: f64) -> &'a str {
204− &self,
205− cx: &mut RenderContext<'bump>,
206− x: f64,
207− y: f64,
208− ) -> &'bump str {
209 bumpalo::format!(in cx.bump, "left: {}px; top: {}px;", x, y).into_bump_str()
200 bumpalo::format!(in cx.bump, "left: {}px; top: {}px;", x, y).into_bump_str()
210 }
201 }
211
202
212 /// Recursively generate `self.count` concentric circles.
203 /// Recursively generate `self.count` concentric circles.
213− fn circle<'bump>(&self, cx: &mut RenderContext<'bump>, elapsed: f64, n: u32) -> Node<'bump> {
204+ fn circle<'a>(&self, cx: &mut RenderContext<'a>, elapsed: f64, n: u32) -> Node<'a> {
214 use dodrio::builder::*;
205 use dodrio::builder::*;
215
206
216 let r = n * 16;
207 let r = n * 16;
@@ -231,13 +222,13 @@ impl Moire {
231 }
222 }
232
223
233 /// Generate inline CSS styles for a circle.
224 /// Generate inline CSS styles for a circle.
234− fn circle_style<'bump>(
225+ fn circle_style<'a>(
235 &self,
226 &self,
236− cx: &mut RenderContext<'bump>,
227+ cx: &mut RenderContext<'a>,
237 elapsed: f64,
228 elapsed: f64,
238 n: u32,
229 n: u32,
239 r: u32,
230 r: u32,
240− ) -> &'bump str {
231+ ) -> &'a str {
241 let (border, alpha) = self.circle_color(elapsed, n);
232 let (border, alpha) = self.circle_color(elapsed, n);
242 let margin = r / 2 + 3;
233 let margin = r / 2 + 3;
243 let style = bumpalo::format!(
234 let style = bumpalo::format!(
examples/sierpinski-triangle/src/lib.rs+7−17
@@ -17,11 +17,7 @@ impl Container {
17 }
17 }
18
18
19 // Generate the container style to fluctuate triangle width.
19 // Generate the container style to fluctuate triangle width.
20− fn container_transform<'bump>(
20+ fn container_transform<'a>(&self, cx: &mut RenderContext<'a>, elapsed: f64) -> &'a str {
21− &self,
22− cx: &mut RenderContext<'bump>,
23− elapsed: f64,
24− ) -> &'bump str {
25 let t = elapsed % 10.0;
21 let t = elapsed % 10.0;
26 let scale = 0.45 + (if t > 5.0 { 10.0 - t } else { t }) / 40.0;
22 let scale = 0.45 + (if t > 5.0 { 10.0 - t } else { t }) / 40.0;
27 let transform = bumpalo::format!(
23 let transform = bumpalo::format!(
@@ -33,7 +29,7 @@ impl Container {
33 }
29 }
34
30
35 // Generate the dot's position on the grid.
31 // Generate the dot's position on the grid.
36− fn dot_style<'bump>(&self, cx: &mut RenderContext<'bump>, x: f64, y: f64) -> &'bump str {
32+ fn dot_style<'a>(&self, cx: &mut RenderContext<'a>, x: f64, y: f64) -> &'a str {
37 let s = self.size * 1.3;
33 let s = self.size * 1.3;
38 let radius = s / 2.0;
34 let radius = s / 2.0;
39 let styles = bumpalo::format!(
35 let styles = bumpalo::format!(
@@ -52,13 +48,7 @@ impl Container {
52 }
48 }
53
49
54 // Create a dot node.
50 // Create a dot node.
55− fn dot<'bump>(
56− &self,
57− cx: &mut RenderContext<'bump>,
51+ fn dot<'a>(&self, cx: &mut RenderContext<'a>, x: f64, y: f64, content: u32) -> Node<'a> {
58− x: f64,
59− y: f64,
60− content: u32,
61− ) -> Node<'bump> {
62 use dodrio::builder::{div, text};
52 use dodrio::builder::{div, text};
63
53
64 div(&cx)
54 div(&cx)
@@ -71,14 +61,14 @@ impl Container {
71 }
61 }
72
62
73 // Create a flattened vector of dot nodes (arranged in recursive triangles)
63 // Create a flattened vector of dot nodes (arranged in recursive triangles)
74− fn triangle<'bump>(
64+ fn triangle<'a>(
75 &self,
65 &self,
76− cx: &mut RenderContext<'bump>,
66+ cx: &mut RenderContext<'a>,
77 x: f64,
67 x: f64,
78 y: f64,
68 y: f64,
79 s: f64,
69 s: f64,
80 content: u32,
70 content: u32,
81− children: &mut bumpalo::collections::Vec<Node<'bump>>,
71+ children: &mut bumpalo::collections::Vec<Node<'a>>,
82 ) {
72 ) {
83 if s <= self.size {
73 if s <= self.size {
84 children.push(self.dot(cx, x, y, content));
74 children.push(self.dot(cx, x, y, content));
@@ -97,7 +87,7 @@ impl Container {
97}
87}
98
88
99impl Render for Container {
89impl Render for Container {
100− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
90+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
101 use dodrio::builder::div;
91 use dodrio::builder::div;
102
92
103 let elapsed = web_sys::window()
93 let elapsed = web_sys::window()
examples/todomvc/src/todo.rs+1−1
@@ -93,7 +93,7 @@ impl<C> Todo<C> {
93}
93}
94
94
95impl<C: TodoActions> Render for Todo<C> {
95impl<C: TodoActions> Render for Todo<C> {
96− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
96+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
97 use dodrio::{
97 use dodrio::{
98 builder::*,
98 builder::*,
99 bumpalo::{self, collections::String},
99 bumpalo::{self, collections::String},
examples/todomvc/src/todos.rs+7−7
@@ -133,7 +133,7 @@ impl<C> Todos<C> {
133
133
134/// Rendering helpers.
134/// Rendering helpers.
135impl<C: TodosActions> Todos<C> {
135impl<C: TodosActions> Todos<C> {
136− fn header<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
136+ fn header<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
137 use dodrio::builder::*;
137 use dodrio::builder::*;
138
138
139 header(&cx)
139 header(&cx)
@@ -166,7 +166,7 @@ impl<C: TodosActions> Todos<C> {
166 .finish()
166 .finish()
167 }
167 }
168
168
169− fn todos_list<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
169+ fn todos_list<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
170 use dodrio::{builder::*, bumpalo::collections::Vec};
170 use dodrio::{builder::*, bumpalo::collections::Vec};
171
171
172 let mut todos = Vec::with_capacity_in(self.todos.len(), cx.bump);
172 let mut todos = Vec::with_capacity_in(self.todos.len(), cx.bump);
@@ -211,7 +211,7 @@ impl<C: TodosActions> Todos<C> {
211 .finish()
211 .finish()
212 }
212 }
213
213
214− fn footer<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
214+ fn footer<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
215 use dodrio::builder::*;
215 use dodrio::builder::*;
216
216
217 let completed_count = self.todos.iter().filter(|t| t.is_complete()).count();
217 let completed_count = self.todos.iter().filter(|t| t.is_complete()).count();
@@ -262,12 +262,12 @@ impl<C: TodosActions> Todos<C> {
262 .finish()
262 .finish()
263 }
263 }
264
264
265− fn visibility_swap<'bump>(
265+ fn visibility_swap<'a>(
266 &self,
266 &self,
267− cx: &mut RenderContext<'bump>,
267+ cx: &mut RenderContext<'a>,
268 url: &'static str,
268 url: &'static str,
269 target_vis: Visibility,
269 target_vis: Visibility,
270− ) -> Node<'bump> {
270+ ) -> Node<'a> {
271 use dodrio::builder::*;
271 use dodrio::builder::*;
272
272
273 li(&cx)
273 li(&cx)
@@ -291,7 +291,7 @@ impl<C: TodosActions> Todos<C> {
291}
291}
292
292
293impl<C: TodosActions> Render for Todos<C> {
293impl<C: TodosActions> Render for Todos<C> {
294− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
294+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
295 use dodrio::builder::*;
295 use dodrio::builder::*;
296
296
297 div(&cx)
297 div(&cx)
src/lib.rs+1−1
@@ -19,7 +19,7 @@
19//! }
19//! }
20//!
20//!
21//! impl<'who> Render for Hello<'who> {
21//! impl<'who> Render for Hello<'who> {
22−//! fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
22+//! fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
23//! use dodrio::builder::*;
23//! use dodrio::builder::*;
24//!
24//!
25//! let id = bumpalo::format!(in cx.bump, "hello-{}", self.who);
25//! let id = bumpalo::format!(in cx.bump, "hello-{}", self.who);
src/render.rs+4−4
@@ -22,7 +22,7 @@ use wasm_bindgen::UnwrapThrowExt;
22/// pub struct MyComponent;
22/// pub struct MyComponent;
23///
23///
24/// impl Render for MyComponent {
24/// impl Render for MyComponent {
25−/// fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
25+/// fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
26/// use dodrio::builder::*;
26/// use dodrio::builder::*;
27///
27///
28/// p(&cx)
28/// p(&cx)
@@ -38,14 +38,14 @@ use wasm_bindgen::UnwrapThrowExt;
38pub trait Render {
38pub trait Render {
39 /// Render `self` as a virtual DOM. Use the given context's `Bump` for
39 /// Render `self` as a virtual DOM. Use the given context's `Bump` for
40 /// temporary allocations.
40 /// temporary allocations.
41− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump>;
41+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a>;
42}
42}
43
43
44impl<'r, R> Render for &'r R
44impl<'r, R> Render for &'r R
45where
45where
46 R: Render,
46 R: Render,
47{
47{
48− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
48+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
49 (**self).render(cx)
49 (**self).render(cx)
50 }
50 }
51}
51}
@@ -54,7 +54,7 @@ impl<R> Render for Rc<R>
54where
54where
55 R: Render,
55 R: Render,
56{
56{
57− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
57+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
58 (**self).render(cx)
58 (**self).render(cx)
59 }
59 }
60}
60}
src/vdom.rs+1−4
@@ -158,10 +158,7 @@ impl Vdom {
158
158
159 /// Construct a `Vdom` with the already-boxed-as-a-trait-object root
159 /// Construct a `Vdom` with the already-boxed-as-a-trait-object root
160 /// rendering component.
160 /// rendering component.
161− pub fn with_boxed_root_render<'a, 'bump>(
161+ pub fn with_boxed_root_render(container: &crate::Element, component: Box<RootRender>) -> Vdom {
162− container: &crate::Element,
163− component: Box<RootRender>,
164− ) -> Vdom {
165 let dom_buffers = [Bump::new(), Bump::new()];
162 let dom_buffers = [Bump::new(), Bump::new()];
166 let change_list = ManuallyDrop::new(ChangeList::new(container));
163 let change_list = ManuallyDrop::new(ChangeList::new(container));
167
164
tests/web/events.rs+2−2
@@ -25,7 +25,7 @@ impl EventContainer {
25}
25}
26
26
27impl Render for EventContainer {
27impl Render for EventContainer {
28− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
28+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
29 use dodrio::builder::*;
29 use dodrio::builder::*;
30 div(&cx)
30 div(&cx)
31 .attr("id", "target")
31 .attr("id", "target")
@@ -134,7 +134,7 @@ impl ListensOnlyOnFirstRender {
134}
134}
135
135
136impl Render for ListensOnlyOnFirstRender {
136impl Render for ListensOnlyOnFirstRender {
137− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
137+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
138 use dodrio::builder::*;
138 use dodrio::builder::*;
139
139
140 let count = self.count.get();
140 let count = self.count.get();
tests/web/js_api.rs+1−1
@@ -37,7 +37,7 @@ impl WrapJs {
37}
37}
38
38
39impl Render for WrapJs {
39impl Render for WrapJs {
40− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
40+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
41 div(&cx)
41 div(&cx)
42 .attr("class", "wrap-js")
42 .attr("class", "wrap-js")
43 .children([self.inner.render(cx)])
43 .children([self.inner.render(cx)])
tests/web/main.rs+3−3
@@ -151,13 +151,13 @@ pub fn assert_rendered<R: Render>(container: &web_sys::Element, r: &R) {
151/// Use the function `F` to render.
151/// Use the function `F` to render.
152pub struct RenderFn<F>(F)
152pub struct RenderFn<F>(F)
153where
153where
154− F: for<'bump> Fn(&mut RenderContext<'bump>) -> Node<'bump>;
154+ F: for<'a> Fn(&mut RenderContext<'a>) -> Node<'a>;
155
155
156impl<F> Render for RenderFn<F>
156impl<F> Render for RenderFn<F>
157where
157where
158− F: for<'bump> Fn(&mut RenderContext<'bump>) -> Node<'bump>,
158+ F: for<'a> Fn(&mut RenderContext<'a>) -> Node<'a>,
159{
159{
160− fn render<'bump>(&self, cx: &mut RenderContext<'bump>) -> Node<'bump> {
160+ fn render<'a>(&self, cx: &mut RenderContext<'a>) -> Node<'a> {
161 (self.0)(cx)
161 (self.0)(cx)
162 }
162 }
163}
163}