Follow

I need to set up a browser bar alias for searching "how the fuck do I ______ in Rust"

Q: "I used rand::Rng in one project, but now when I say `use rand::Rng` in another, it says it's an 'unresolved import'. What gives?"

A: You forgot to add it to Cargo.toml under [dependencies].

Q: "I want to have this function return a tuple of values, but I don't know how long the tuple will be at compile time, and tuples don't have a formal type so I can't just say "return a tuple". How can I do this?"

A: Use a Vector instead. They actually have a type so you can just return a Vec<i32> or whatever.

Q: "I keep getting these annoying compiler errors about capital let--"

A: I'm gonna stop you right there. Put #![allow(non_snake_case)] at the top of every Rust file you write.

(At least the Python interpreter doesn't yell at you about PEP8 every time you use it.)

@noelle that could be a whole blog full of answers >_> you should write that

Sign in to participate in the conversation
Elekk: Mastodon for Gamers

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!