Skip to content

Commit 32def70

Browse files
committed
fix lipsum dependency
lipsum hasn't publish a version for rand 0.9 yet, but that exists on master
1 parent bbd89d9 commit 32def70

7 files changed

Lines changed: 31 additions & 32 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/function_router/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
license = "MIT OR Apache-2.0"
66

77
[dependencies]
8-
lipsum = "0.9.1"
8+
lipsum = { version = "0.9.1", git = "https://github.com/mgeisler/lipsum.git", branch = "master" }
99
log = "0.4"
1010
rand = { version = "0.9", features = ["small_rng"] }
1111
yew = { path = "../../packages/yew" }

examples/function_router/src/generator.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use lipsum::MarkovChain;
22
use once_cell::sync::Lazy;
3-
use rand::distributions::Bernoulli;
3+
use rand::distr::Bernoulli;
44
use rand::rngs::StdRng;
55
use rand::seq::IteratorRandom;
66
use rand::{Rng, SeedableRng};
@@ -28,12 +28,12 @@ impl Generator {
2828
}
2929
impl Generator {
3030
pub fn new_seed(&mut self) -> u32 {
31-
self.rng.gen()
31+
self.rng.random()
3232
}
3333

3434
/// [low, high)
3535
pub fn range(&mut self, low: u32, high: u32) -> u32 {
36-
self.rng.gen_range(low..high)
36+
self.rng.random_range(low..high)
3737
}
3838

3939
/// `n / d` chance
@@ -42,7 +42,7 @@ impl Generator {
4242
}
4343

4444
pub fn image_url(&mut self, dimension: (u32, u32), keywords: &[String]) -> String {
45-
let cache_buster = self.rng.gen::<u16>();
45+
let cache_buster = self.rng.random::<u16>();
4646
let (width, height) = dimension;
4747
format!(
4848
"https://source.unsplash.com/random/{}x{}?{}&sig={}",
@@ -61,13 +61,13 @@ impl Generator {
6161
const SYLLABLES_MIN: u32 = 1;
6262
const SYLLABLES_MAX: u32 = 5;
6363

64-
let n_syllables = self.rng.gen_range(SYLLABLES_MIN..SYLLABLES_MAX);
64+
let n_syllables = self.rng.random_range(SYLLABLES_MIN..SYLLABLES_MAX);
6565
let first_name = SYLLABLES
6666
.split_whitespace()
6767
.choose_multiple(&mut self.rng, n_syllables as usize)
6868
.join("");
6969

70-
let n_syllables = self.rng.gen_range(SYLLABLES_MIN..SYLLABLES_MAX);
70+
let n_syllables = self.rng.random_range(SYLLABLES_MIN..SYLLABLES_MAX);
7171
let last_name = SYLLABLES
7272
.split_whitespace()
7373
.choose_multiple(&mut self.rng, n_syllables as usize)
@@ -80,7 +80,7 @@ impl Generator {
8080
const KEYWORDS_MIN: u32 = 1;
8181
const KEYWORDS_MAX: u32 = 4;
8282

83-
let n_keywords = self.rng.gen_range(KEYWORDS_MIN..KEYWORDS_MAX);
83+
let n_keywords = self.rng.random_range(KEYWORDS_MIN..KEYWORDS_MAX);
8484
KEYWORDS
8585
.split_whitespace()
8686
.map(ToOwned::to_owned)
@@ -92,7 +92,7 @@ impl Generator {
9292
const WORDS_MAX: u32 = 8;
9393
const SMALL_WORD_LEN: u32 = 3;
9494

95-
let n_words = self.rng.gen_range(WORDS_MIN..WORDS_MAX);
95+
let n_words = self.rng.random_range(WORDS_MIN..WORDS_MAX);
9696

9797
let mut title = String::new();
9898

@@ -121,15 +121,15 @@ impl Generator {
121121
const WORDS_MIN: u32 = 7;
122122
const WORDS_MAX: u32 = 25;
123123

124-
let n_words = self.rng.gen_range(WORDS_MIN..WORDS_MAX);
124+
let n_words = self.rng.random_range(WORDS_MIN..WORDS_MAX);
125125
YEW_CHAIN.generate_with_rng(&mut self.rng, n_words as usize)
126126
}
127127

128128
pub fn paragraph(&mut self) -> String {
129129
const SENTENCES_MIN: u32 = 3;
130130
const SENTENCES_MAX: u32 = 20;
131131

132-
let n_sentences = self.rng.gen_range(SENTENCES_MIN..SENTENCES_MAX);
132+
let n_sentences = self.rng.random_range(SENTENCES_MIN..SENTENCES_MAX);
133133
let mut paragraph = String::new();
134134
for i in 0..n_sentences {
135135
if i > 0 {

examples/function_router/src/pages/author_list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rand::{distributions, Rng};
1+
use rand::{distr, Rng};
22
use yew::prelude::*;
33

44
use crate::components::author_card::AuthorCard;
@@ -59,8 +59,8 @@ pub fn AuthorList() -> Html {
5959
}
6060

6161
fn random_author_seeds() -> Vec<u32> {
62-
rand::thread_rng()
63-
.sample_iter(distributions::Standard)
62+
rand::rng()
63+
.sample_iter(distr::StandardUniform)
6464
.take(2)
6565
.collect()
6666
}

examples/router/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
66

77
[dependencies]
88
instant = { version = "0.1", features = ["wasm-bindgen"] }
9-
lipsum = "0.9.1"
9+
lipsum = { version = "0.9.1", git = "https://github.com/mgeisler/lipsum.git", branch = "master" }
1010
log = "0.4"
1111
getrandom = { version = "0.2", features = ["js"] }
1212
rand = { version = "0.9", features = ["small_rng"] }

examples/router/src/generator.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use lipsum::MarkovChain;
22
use once_cell::sync::Lazy;
3-
use rand::distributions::Bernoulli;
3+
use rand::distr::Bernoulli;
44
use rand::rngs::SmallRng;
55
use rand::seq::IteratorRandom;
66
use rand::{Rng, SeedableRng};
@@ -28,12 +28,12 @@ impl Generator {
2828
}
2929
impl Generator {
3030
pub fn new_seed(&mut self) -> u64 {
31-
self.rng.gen()
31+
self.rng.random()
3232
}
3333

3434
/// [low, high)
3535
pub fn range(&mut self, low: usize, high: usize) -> usize {
36-
self.rng.gen_range(low..high)
36+
self.rng.random_range(low..high)
3737
}
3838

3939
/// `n / d` chance
@@ -42,7 +42,7 @@ impl Generator {
4242
}
4343

4444
pub fn image_url(&mut self, dimension: (usize, usize), keywords: &[String]) -> String {
45-
let cache_buster = self.rng.gen::<u16>();
45+
let cache_buster = self.rng.random::<u16>();
4646
let (width, height) = dimension;
4747
format!(
4848
"https://source.unsplash.com/random/{}x{}?{}&sig={}",
@@ -61,13 +61,13 @@ impl Generator {
6161
const SYLLABLES_MIN: usize = 1;
6262
const SYLLABLES_MAX: usize = 5;
6363

64-
let n_syllables = self.rng.gen_range(SYLLABLES_MIN..SYLLABLES_MAX);
64+
let n_syllables = self.rng.random_range(SYLLABLES_MIN..SYLLABLES_MAX);
6565
let first_name = SYLLABLES
6666
.split_whitespace()
6767
.choose_multiple(&mut self.rng, n_syllables)
6868
.join("");
6969

70-
let n_syllables = self.rng.gen_range(SYLLABLES_MIN..SYLLABLES_MAX);
70+
let n_syllables = self.rng.random_range(SYLLABLES_MIN..SYLLABLES_MAX);
7171
let last_name = SYLLABLES
7272
.split_whitespace()
7373
.choose_multiple(&mut self.rng, n_syllables)
@@ -80,7 +80,7 @@ impl Generator {
8080
const KEYWORDS_MIN: usize = 1;
8181
const KEYWORDS_MAX: usize = 4;
8282

83-
let n_keywords = self.rng.gen_range(KEYWORDS_MIN..KEYWORDS_MAX);
83+
let n_keywords = self.rng.random_range(KEYWORDS_MIN..KEYWORDS_MAX);
8484
KEYWORDS
8585
.split_whitespace()
8686
.map(ToOwned::to_owned)
@@ -92,7 +92,7 @@ impl Generator {
9292
const WORDS_MAX: usize = 8;
9393
const SMALL_WORD_LEN: usize = 3;
9494

95-
let n_words = self.rng.gen_range(WORDS_MIN..WORDS_MAX);
95+
let n_words = self.rng.random_range(WORDS_MIN..WORDS_MAX);
9696
let mut title = String::new();
9797

9898
let words = YEW_CHAIN
@@ -120,15 +120,15 @@ impl Generator {
120120
const WORDS_MIN: usize = 7;
121121
const WORDS_MAX: usize = 25;
122122

123-
let n_words = self.rng.gen_range(WORDS_MIN..WORDS_MAX);
123+
let n_words = self.rng.random_range(WORDS_MIN..WORDS_MAX);
124124
YEW_CHAIN.generate_with_rng(&mut self.rng, n_words)
125125
}
126126

127127
pub fn paragraph(&mut self) -> String {
128128
const SENTENCES_MIN: usize = 3;
129129
const SENTENCES_MAX: usize = 20;
130130

131-
let n_sentences = self.rng.gen_range(SENTENCES_MIN..SENTENCES_MAX);
131+
let n_sentences = self.rng.random_range(SENTENCES_MIN..SENTENCES_MAX);
132132
let mut paragraph = String::new();
133133
for i in 0..n_sentences {
134134
if i > 0 {

examples/router/src/pages/author_list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rand::{distributions, Rng};
1+
use rand::{distr, Rng};
22
use yew::prelude::*;
33

44
use crate::components::author_card::AuthorCard;
@@ -75,8 +75,8 @@ impl Component for AuthorList {
7575
}
7676

7777
fn random_author_seeds() -> Vec<u64> {
78-
rand::thread_rng()
79-
.sample_iter(distributions::Standard)
78+
rand::rng()
79+
.sample_iter(distr::StandardUniform)
8080
.take(2)
8181
.collect()
8282
}

0 commit comments

Comments
 (0)