Questions tagged [rust]

Rust is a systems programming language focused on three goals: safety, speed, and concurrency. It maintains these goals without needing a garbage collector, making it a useful language for a number of use cases other languages aren't good at: embedding in other languages, programs with specific space and time requirements, and writing low-level code, like device drivers and operating systems.

Tag excerpt copied from: http://stackoverflow.com/tags/rust/info

48 questions
4
votes
1 answer

Can an object be moved through a match expression?

I am using Rust 1.15.1 and, recently, I stumbled over a problem I could not find a straight forward solution for. When you look at examples using pattern matching they usually destructure the object in the match expression and continue to work with…
Jonny Dee
  • 957
4
votes
1 answer

Publishing a crate containing both lib.rs and main.rs files

In the Importing External Crates section of the Rust book the author creates main.rs file in an already existing library project. I randomly picked up a bunch of crates from crates.io, examined their structure and did not find any project containing…
Sergey
  • 263
-2
votes
1 answer

How would data be dynamically queried in rust

Say there is an user that wants to query a random element during runtime from a dynamic struct. The type of the data is unknown, but all the data is either a integer (size unknown), float, string, or vector of one of the aft-mentioned structs, and…
Star
  • 1
-2
votes
1 answer

Rust and composition

I have a piece of code. struct HasName { name: &'static str } trait CanGreet { fn greet(&self); } impl CanGreet for HasName { fn greet(&self) { println!("Hello {}", self.name); } } struct Person { has_name:…
Tristan
  • 21