Rust Traits over Go Interfaces

Don’t be such a square!

Photo by Paul Einerhand on Unsplash

Reading back over traits in “The Book” of Rust (that has a biblical feel, doesn’t it?), I realized something that was totally impossible in Go: implementing traits for non-local types i.e. types that you did not create yourself. To see what I mean concretely, let’s say that we wanted to define a method for floating-point numbers. Sure, it’s actually far fewer…