Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRustnewtype and DerefSingle-choice MCQ

With `struct Wrapper(String);` and `impl Deref<Target = String> for Wrapper`, which call works only because of deref coercion?

let w = Wrapper(String::from("hello")); let n: usize = w.len(); // line A let s: &str = &w; // line B