#[macro_use]externcratelazy_static;pubfnvowel_count(some_string:&str)->usize{lazy_static!{staticrefVOWELS:Vec<char>=vec!['a','e','i','o','u'];}some_string.to_ascii_lowercase().chars().filter(|c|VOWELS.contains(c)).count()}#[cfg(test)]modtests{usecrate::vowel_count;#[test]fnit_works_with_an_empty_string(){assert_eq!(vowel_count(""),0);}#[test]fnit_works_non_vowel_strings(){assert_eq!(vowel_count("d"),0);assert_eq!(vowel_count("drthpCVM *&^"),0);assert_eq!(vowel_count("1234567890!@#$%^&*()--__+="),0);assert_eq!(vowel_count("NPlkv.,<>?/"),0);}#[test]fnit_works_for_strings_of_just_vowels(){assert_eq!(vowel_count("a"),1);assert_eq!(vowel_count("A"),1);assert_eq!(vowel_count("AaeEiIoOuU"),10);assert_eq!(vowel_count("eoiuioEAUIAEoieaiAoe"),20);}#[test]fnit_works_for_mixed_strings(){assert_eq!(vowel_count("deadpool"),4);assert_eq!(vowel_count("This is just a sentence! With some words and symbols #$%"),13);assert_eq!(vowel_count("TESTING OUT YELLING WITH ALL CAPS"),9);assert_eq!(vowel_count("!@# \nThis is THE MOST COMPLICATED test SoO farrrr"),12);}}
I'm still live streaming as I type this out, but once I wrap up I'll post a link to the video here!
Turns out OBS didn't want to behave for me today, and split my stream into 2 and dies before I finished, but we got almost all of it recorded! Learnings for next stream!
Links to the video that recorded for the longest here
Oh I've been waiting for this one all morning! Decided I wanted to go all out on this on!
Come check it out while I work my way through this challenge! I'm live now and about to get started!
twitch.tv/coreyja
Here is my Rust solution all TDD'ed out!
I'm still live streaming as I type this out, but once I wrap up I'll post a link to the video here!
Ahhh! :panic:
Turns out OBS didn't want to behave for me today, and split my stream into 2 and dies before I finished, but we got almost all of it recorded! Learnings for next stream!
Links to the video that recorded for the longest here
Livestream - Dev.to Challenge Vowel Count in Rust
Corey Alexander ・ Jun 30 ・ 1 min read