Skip to main content

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.

Filter by
Sorted by
Tagged with
4 votes
3 answers
314 views

Not long ago while I was exploring for solutions to test without mocks I've found out about the functional core, imperative shell architecture. It sounds great, I also think that it would play nicely ...
 sentientbottleofwine's user avatar
2 votes
3 answers
317 views

I'm currently reading "Implementing Domain-Driven Design" while going through the code samples, but I'm having trouble modeling aggregates that stores a huge list of value objects. For ...
Kyle Richards's user avatar
0 votes
2 answers
343 views

I'm reading the second chapter of the official Rust book as a pretty seasoned python programmer. As you can imagine, its been pretty jarring, but I'm learning. My specific question is about whether or ...
Ryan Folks's user avatar
1 vote
1 answer
240 views

When compiling Rust, various additional checks are made for correctness. These include bounds checking, borrow checking for multithreading and memory ownership, and the like. Once compiled, these ...
John Moser's user avatar
0 votes
2 answers
107 views

I am currently implementing a library in Rust that implements a proprietary serial protocol. The protocol specifies several enum values, that mostly are returned by the hardware as u8s (bytes), but ...
Richard Neumann's user avatar
1 vote
0 answers
165 views

I'm writing a compiler in Rust. I've reached the point where I have an AST and am ready to do symbol resolution, type-checking, etc. But, I'm unsure of how to represent an AST as containing "...
gmdev's user avatar
  • 119
1 vote
0 answers
148 views

I'm building an HTTP API database adapter that has an authentication component. Users can authenticate using password, federated login such as OAUTH, and JWT. My initial design is something like the ...
seve's user avatar
  • 119
2 votes
1 answer
672 views

Although I love Rust's enums (and the idea of making illegal states unrepresentable), I'm struggling to represent (ironic, yes) them in databases like PostgreSQL when the variants have data associated ...
yoshke's user avatar
  • 29
2 votes
1 answer
2k views

This is just an example of an (still incomplete) real-world project written in Rust using a clean architecture: https://github.com/frederikhors/rust-clean-architecture-with-db-transactions. Goals My ...
Fred Hors's user avatar
  • 139
1 vote
1 answer
362 views

I have a little bit of experience with Go, that I have been trying to use as a reference point to wrap my mind around Rust via a cards game I wrote in Go that I would like to now write in Rust. I know ...
Daniel's user avatar
  • 119
-2 votes
1 answer
166 views

A social network has API, but also it has some limitations like the amount of requests that can be done in one second (let's say API will give an error, if it accepts more than 3 requests per second) ...
Roy King's user avatar
4 votes
5 answers
2k views

I was reading about composition over inheritance and came across a question about solving the Circle-Ellipse Problem in Object-Oriented Programming. This kind of problem is often used as an example of ...
drkvogel's user avatar
  • 157
4 votes
1 answer
565 views

Let's take at random a well-written piece of Rust code: let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { label: Some("Shader"), flags: wgpu::ShaderFlags::...
Zomagk's user avatar
  • 261
67 votes
9 answers
9k views

Java has "checked exceptions", which force the caller of the method to either handle an exception or to rethrow it, e.g. // requires ParseException to be handled or rethrown int i = ...
Heinzi's user avatar
  • 9,868
3 votes
1 answer
3k views

this is my first post on here, and I'm wondering about a good rust implementation with traits on enum types. I want to know if using an enum w/ a trait as a generator of different code is viable like ...
Truffle's user avatar
  • 39
10 votes
1 answer
452 views

Tiled images Tiled images are large images that have been split in smaller square tiles. There are several tiled image formats, with different ways of organizing the tile files. A tiled image on ...
lovasoa's user avatar
  • 209
5 votes
3 answers
541 views

In Rust, Send (or Sync) marker traits are used to indicate whether a value of a type (or a reference to that) can be worked on within threaded context. However, it is an attribute of a function or a ...
Amin Sameti's user avatar
10 votes
5 answers
846 views

I've been thinking a lot lately about safe code. Thread-safe. Memory-safe. Not-going-to-explode-in-your-face-with-a-segfault safe. But for the sake of clarity in the question, let's use Rust's safety ...
TheEnvironmentalist's user avatar
4 votes
1 answer
657 views

Rust is advertised as a "concurrent" language, what does this mean specifically and how is it different from other languages such as C++?
Greg's user avatar
  • 153
-2 votes
1 answer
359 views

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 {}", ...
Tristan's user avatar
  • 21
8 votes
2 answers
753 views

I recently I started learning Rust and Scala and what struck me was the lack of inheritance model that I'm used to in C++ and Java. Although I can model simple things with structs and traits in Rust,...
sadiq.ali's user avatar
  • 217
6 votes
1 answer
462 views

I'm writing a compiler that compiles to C, one thing I'm attempting to do is implement a construct like Rust's match: // { some function let mut foo = 32; match foo { 3 => return "...
Jon Flow's user avatar
  • 383
40 votes
2 answers
4k views

Questions I am trying to understand whether Rust fundamentally and sufficiently improves upon the concurrency facilities of C++ so that to decide if I should spend the time to learn Rust. ...
thb's user avatar
  • 757
7 votes
1 answer
564 views

I am currently writing an API for machine learning algorithms in Rust and I would like for a single genetic algorithm, artificial neural network, or Bayesian network to provide multiple outputs so ...
vadix's user avatar
  • 81
11 votes
2 answers
4k views

I've been reading some articles on how Rust does error handling using the Result<T, E> type and to me it seems like a hybrid best-of-both-worlds (exceptions and return codes) solution which can ...
stijn's user avatar
  • 4,168