on master help sign in
sierpinski example: Small style nitpicks and punctuation
6887d09Nick Fitzgerald
examples/sierpinski-triangle/src/lib.rs+7−8
@@ -1,24 +1,23 @@
1−use std::cell::RefCell;
2−use std::rc::Rc;
3−
4use dodrio::bumpalo::{self, Bump};
1use dodrio::bumpalo::{self, Bump};
5use dodrio::{Node, Render, Vdom};
2use dodrio::{Node, Render, Vdom};
3+use std::cell::RefCell;
4+use std::rc::Rc;
6use wasm_bindgen::prelude::*;
5use wasm_bindgen::prelude::*;
7use wasm_bindgen::JsCast;
6use wasm_bindgen::JsCast;
8use web_sys::Window;
7use web_sys::Window;
9
8
10−// Triangle container defining target size
9+// Triangle container defining target size.
11struct Container {
10struct Container {
12 size: f64,
11 size: f64,
13}
12}
14
13
15impl Container {
14impl Container {
16− // Construct a new container
15+ // Construct a new container.
17 pub fn new() -> Container {
16 pub fn new() -> Container {
18 Container { size: 25.0 }
17 Container { size: 25.0 }
19 }
18 }
20
19
21− // Generate the container style to fluctuate triangle width
20+ // Generate the container style to fluctuate triangle width.
22 fn container_transform<'a, 'bump>(&'a self, bump: &'bump Bump, elapsed: f64) -> &'bump str
21 fn container_transform<'a, 'bump>(&'a self, bump: &'bump Bump, elapsed: f64) -> &'bump str
23 where
22 where
24 'a: 'bump,
23 'a: 'bump,
@@ -33,7 +32,7 @@ impl Container {
33 transform.into_bump_str()
32 transform.into_bump_str()
34 }
33 }
35
34
36− // Generate the dot's position on the grid
35+ // Generate the dot's position on the grid.
37 fn dot_style<'a, 'bump>(&'a self, bump: &'bump Bump, x: f64, y: f64) -> &'bump str
36 fn dot_style<'a, 'bump>(&'a self, bump: &'bump Bump, x: f64, y: f64) -> &'bump str
38 where
37 where
39 'a: 'bump,
38 'a: 'bump,
@@ -55,7 +54,7 @@ impl Container {
55 styles.into_bump_str()
54 styles.into_bump_str()
56 }
55 }
57
56
58− // Create a dot node
57+ // Create a dot node.
59 fn dot<'a, 'bump>(&'a self, bump: &'bump Bump, x: f64, y: f64, content: u32) -> Node<'bump>
58 fn dot<'a, 'bump>(&'a self, bump: &'bump Bump, x: f64, y: f64, content: u32) -> Node<'bump>
60 where
59 where
61 'a: 'bump,
60 'a: 'bump,