Rust's approach seems more similar to the approach described in the section on extension methods, which the author admits solves the problem but doesn't like the implications for encapsulation (which isn't a problem in Rust, as long as you're writing this method in the same crate as the type definition). But Rust also doesn't have classic Java-style classes, so the requirement to "keep the member definition within the class" is already meaningless in Rust terms.
In contrast C++ won't even let you have std::unordered_map<Goose,int> because it wants to know how to compare and hash the keys before making the type at all.