add generate url method
This commit is contained in:
@@ -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