add generate url method

This commit is contained in:
2025-09-01 19:50:34 +09:00
parent 1b661f9848
commit 71dc92c133

View File

@@ -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)]