Hacker News new | ask | show | jobs
by kaikalii 1131 days ago

    trait Namer {
        fn first(&self) -> String;
        fn last(&self) -> String;
        // You can put this here if you want `namer.name()`
        fn name(&self) -> String {
            format!("{} {}", self.first(), self.last())
        }
    }

    fn name(n: &impl Namer) -> String {
        format!("{} {}", n.first(), n.last())
    }
1 comments

cool much thanks, one more reason to move to Rust hehe - since "let else" was added its looking pretty attractive
let else is a rather minor addition, surprising that that's what's winning you over