first successful download

This commit is contained in:
ThetaDev 2022-08-06 23:37:27 +02:00
parent a6041a013b
commit beb1177a11
16 changed files with 4076 additions and 121 deletions

View file

@ -8,7 +8,7 @@ const CONTENT_PLAYBACK_NONCE_ALPHABET: &[u8; 64] =
pub fn get_cg_from_regexes<'a, I>(mut regexes: I, text: &str, cg: usize) -> Option<String>
where
I: Iterator<Item = &'a Regex>,
{
{
regexes
.find_map(|pattern| pattern.captures(text).ok().flatten())
.map(|c| c.get(cg).unwrap().as_str().to_owned())
@ -21,9 +21,9 @@ pub fn random_string(charset: &[u8], length: usize) -> String {
unsafe {
for _ in 0..length {
result.push(
char::from(*charset.get_unchecked(rng.gen_range(0..charset.len())))
);
result.push(char::from(
*charset.get_unchecked(rng.gen_range(0..charset.len())),
));
}
}