Comment

Comment by 2h

question for all you Rust people. does Rust have a way to use interfaces like Go? For example with Go I can do this:

    package hello
    
    type namer interface {
       first() string
       last() string
    }
    
    func name(n namer) string {
       return n.first() + " " + n.last()
    }
I think I saw on a blog post that Rust can only do this with some hacks, is that true?
parent 2h 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton