Created
July 15, 2025 14:08
-
-
Save ptdecker/420242a0217042c6c9110036b3b0525b to your computer and use it in GitHub Desktop.
Incorrect type identification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl ConsumerId { | |
pub fn new() -> Self { | |
#[cfg(not(feature = "string-consumer-id"))] | |
let consumer_id = Uuid::new_v4(); | |
#[cfg(feature = "string-consumer-id")] | |
let consumer_id = { | |
let length = 10; | |
let mut rng = rand::thread_rng(); | |
let letters: Vec<char> = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars().collect(); | |
(0..length) | |
.map(|_| { | |
let random_index = rng.gen_range(0..letters.len()); | |
letters[random_index] | |
}) | |
.collect() | |
}; | |
Self { id: consumer_id } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment