Skip to content

Commit 263221b

Browse files
committed
Update sycamore to v0.5.1
1 parent 9e09dea commit 263221b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

frameworks/keyed/sycamore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["cdylib"]
1010
[dependencies]
1111
getrandom = {version = "0.2", features = ["js"]}
1212
rand = {version = "0.8", features = ["small_rng"]}
13-
sycamore = "0.5"
13+
sycamore = "0.5.1"
1414
wasm-bindgen = "0.2.74"
1515
web-sys = {version = "0.3.51", features = ["Window", "Document"]}
1616

frameworks/keyed/sycamore/src/lib.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,20 @@ fn build_data(count: usize) -> Vec<RowData> {
7777
data.reserve_exact(count);
7878

7979
for _i in 0..count {
80-
let label = Signal::new(format!(
81-
"{} {} {}",
82-
ADJECTIVES.choose(&mut thread_rng).unwrap(),
83-
COLOURS.choose(&mut thread_rng).unwrap(),
84-
NOUNS.choose(&mut thread_rng).unwrap()
85-
));
80+
let adjective = ADJECTIVES.choose(&mut thread_rng).unwrap();
81+
let colour = COLOURS.choose(&mut thread_rng).unwrap();
82+
let noun = NOUNS.choose(&mut thread_rng).unwrap();
83+
let capacity = adjective.len() + colour.len() + noun.len() + 2;
84+
let mut label = String::with_capacity(capacity);
85+
label.push_str(adjective);
86+
label.push(' ');
87+
label.push_str(colour);
88+
label.push(' ');
89+
label.push_str(noun);
8690

8791
data.push(RowData {
8892
id: ID_COUNTER.load(Ordering::Relaxed),
89-
label,
93+
label: Signal::new(label),
9094
});
9195

9296
ID_COUNTER.store(ID_COUNTER.load(Ordering::Relaxed) + 1, Ordering::Relaxed);

0 commit comments

Comments
 (0)