Traits in Rust seem at least superficially similar to typeclasses in Haskell, however I’ve seen people write that there are some differences between them. I was wondering exactly what...
I’m reading the documentation for File: //.. let mut file = File::create("foo.txt")?; //.. What is the ? in this line? I do not recall seeing it in the Rust...
I wrote some Rust code that takes a &String as an argument: fn awesome_greeting(name: &String) { println!("Wow, you are awesome, {}!", name); } I’ve also written code that takes...
I wasn’t able to find the Rust equivalent for the “join” operator over a vector of Strings. I have a Vec<String> and I’d like to join them as a...
How do you access a Cargo package’s metadata (e.g. version) from the Rust code in the package? In my case, I am building a command line tool that I’d...
With Rust being comparatively new, I’ve seen far too many ways of reading and writing files. Many are extremely messy snippets someone came up with for their blog, and...
By following this guide I created a Cargo project. src/main.rs fn main() { hello::print_hello(); } mod hello { pub fn print_hello() { println!("Hello, world!"); } } which I run...
What is the best way to create and use a struct with only one instantiation in the system? Yes, this is necessary, it is the OpenGL subsystem, and making...
I’m having a hard time figuring out how string syntax works in Rust. Specifically, I’m trying to figure out how to make a multiple line string. 5 Answers 5
When running a sum loop over an array in Rust, I noticed a huge performance drop when CAPACITY >= 240. CAPACITY = 239 is about 80 times faster. Is...