Re:Rust vs. Go
by bluejekyll on Wednesday January 18, 2017 @07:14PM
(#13431781)
Have a link to your code?
> HashMap<T: Hash+Eq, u64>
I can take a wild guess that T is a generic type defined on either the method, struct or impl in which this HashMap is declared. It's on the method/struct/impl. You don't necessarily need the type bound on the struct, but you do on the impl declaration:
struct MyStruct<T: Hash+Eq> { map: HashMap<T, u64> }
impl<T: Hash+Eq> MyStruct<T> { pub fn insert_something(&mut self, my_key: T, my_int: u64) { self.map.insert(my_key, my_int); } }
try it here: https://is.gd/RwUpQx
Re:Rust vs. Go
by moosingin3space on Thursday January 19, 2017 @02:22PM
(#13438674)
Please don't hesitate to ask for help on #rust-beginners. I was in your situation last May, and hanging out on IRC was an excellent experience. Rustaceans, generally speaking, will bend over backwards to help you work on your project.
My understanding is that the rust team has put 2 priorities ahead of everything else: zero cost abstraction and safety. Given those constraints they've done a fantastic job in the area of ergonomics, but I don't know if it will ever be easy. Maybe rust is as easy to use as it can be.