Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRustCow clone-on-writeSingle-choice MCQ

What does this function return for the inputs `"hello"` and `"Hello"`, in terms of allocation?

use std::borrow::Cow; fn normalize(s: &str) -> Cow<'_, str> { if s.chars().all(|c| c.is_lowercase()) { Cow::Borrowed(s) } else { Cow::Owned(s.to_lowercase()) } }