add generate url method
This commit is contained in:
1 parent
1b661f9848
commit
71dc92c133
1 file changed
+6
@@ -1,6 +1,7 @@
|
||||
use compact_str::CompactString;
|
||||
use rand::seq::IteratorRandom;
|
||||
use regex::Regex;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RandomUrlGenerator<Rng: rand::Rng> {
|
||||
@@ -89,6 +90,11 @@ impl<Rng: rand::Rng> RandomUrlGenerator<Rng> {
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
pub fn generate_url(&mut self) -> Result<Url, url::ParseError> {
|
||||
let url = self.generate();
|
||||
Url::parse(&url)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
||||
Reference in new issue
Block a user