// AsRef<str> accepts &str, String, &String, Box<str>, ...
fn word_count(text: impl AsRef<str>) -> usize {
text.as_ref().split_whitespace().count()
}
fn main() {
println!("{}", word_count("a b c"));
println!("{}", word_count(String::from("x y")));
}impl AsRef<str> is the flexible param