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 ...

learn more… | top users | synonyms

0
votes
1answer
9 views

Rust: Merging Overlapping Intervals

I'm getting myself acquainted with Rust and decided to implement the classical overlapping intervals problem. Here is a statement of the problem: Given a collection of intervals, write a ...
6
votes
1answer
23 views

Implementing a van Emde Boas tree in Rust

I wanted to implement a van Emde Boas Tree in Rust, to start learning the language. Much of my implementation is derived from the pseudo-code on wikipedia, with the exception that empty subtrees are ...
3
votes
2answers
37 views

Netscape bookmark file generator

I started to learn Rust some time ago and I wonder if there is some way to write Rust code that is both concise and safe — in particular, avoiding unwrap(), casting ...
7
votes
1answer
55 views

Detecting two keys pressed in quick succession

My computer has been having this issue where when I press a key, two key presses get registered. The goal of this program is to detect the time delta between the two keys so that I can set an ...
5
votes
1answer
90 views

Rust language tag implementation

language-tags is my first crate, it is hosted on GitHub and I uploaded it to Crates.io. It parses language tags like en-US into useful parts, like language and ...
5
votes
1answer
61 views

Simple cat in Rust

I'm learning Rust, from a Python background, and while I've used languages like C and C++ in the (distant) past, system languages aren't really my specialty. I would just like to know if my code is ...
1
vote
0answers
64 views

Custom `Decodable` for enum

I need to implement a decoding in the next JSONs: First variant: {} Second variant: ...
8
votes
1answer
50 views

Recursively pop the last node from a singly linked list

I am exploring different ways of implementing a linked list in Rust as a learning project. In one particular place, I've got some code that works properly, but it makes multiple calls to unwrap--I am ...
7
votes
0answers
118 views

Rust Brainfuck interpreter

I took the code from kostyas benchmarks for the Rust Brainfuck interpreter and tried to optimize it. There is also a discussion on Reddit about the poor performance of Rust in the Benchmark. Before ...
2
votes
1answer
101 views

Sieve of Eratosthenes Optimization in Rust

When I want to try a new language, I first try to write a fairly basic sieve of Eratosthenes project in said language. This is a very simple algorithm, with predictable results, and can even be ...
4
votes
1answer
112 views

Input/output for a simple Brainfuck interpreter

The following code comes from a simple Brainfuck interpreter I'm working on to learn the Rust language. Error handling is omitted for simplicity. It is tested on ...
12
votes
1answer
155 views

Wanted a cat. Got lolcat

Wanna learn Rust? Ya rly! I can haz FizzBuzz? No wai! Gimme /bin/cat then. But rustc say LOL! Must handle teh err0rz! Now iz ...
5
votes
1answer
43 views

Using parser_combinators to parse a string

I am playing with Rust, and am trying to write a simple parser. I need to parse the string: "0123,456789" into a stucture: ...
3
votes
1answer
40 views

SICP Exercise 1.3: Sum of squares of two largest numbers out of three, Rust Version

The exercise 1.3 of the book Structure and Interpretation of Computer Programs asks the following: Exercise 1.3. Define a procedure that takes three numbers as arguments and returns the sum of ...
6
votes
1answer
84 views

General Fizzbuzz

I'm learning Rust now and created a program to solve the task General Fizzbuzz on Rosetta Code. For example, given: 20 3 Fizz 5 Buzz 7 Baxx where the first line ...
6
votes
2answers
200 views

Rust Guessing Game

Am I making good use of the Rust language and APIs? What can be improved? ...
2
votes
1answer
170 views

Rust version of my C++ command-line tool

First program I've written in Rust (besides the demos in the tutorial site). I decided to start by converting my C++ command line tool to Rust. This is not necessarily a 1 to 1 conversion, but I've ...
2
votes
1answer
43 views

Differentiate simple expressions

This is the first program I have written in Rust and I would like to know what some Rust experts think of it. I must be doing some stuff wrong, such as breaking code style, etc. The code ...
6
votes
1answer
160 views

Bitcoin algorithm BIP0039: Mnemonic code for generating deterministic keys

This is an implementation of BIP0039 in Rust (I used python-mnemonic as a guide). I'd like my first Rust program to be critiqued. I would like to know if the program is structured correctly, if I've ...
3
votes
1answer
117 views

Text formatting with embedded markup for terminal output

I'm learning Rust. I wrote the following library to format text and output it to terminal, so that the formatting markup is embedded with the string itself (looks similar to HTML4). I feel the code ...
7
votes
2answers
2k views

How can I find out why this Rust program to echo lines from stdin is slow?

Given the following Rust program: ...
1
vote
1answer
87 views

Sum of N primes in parallel-ish

Linq's AsParallel() call would be my normal way of doing something like this, but Rust hasn't stolen that just yet. This method has obvious shortcomings, but I'm ...
6
votes
1answer
668 views

K-Means in Rust

I have implemented for learning purposes a simple K-Means clustering algorithm in Rust. For those who are not familiar: you are given N points, say in the plane, ...
2
votes
1answer
298 views

Chat console using Ruby and Rust

One of the exercises I like to program when learning a new language is a chat client for the console. I've programmed it in many languages (Perl, Python, C, C++, JavaScript, ...). One of the versions ...
7
votes
1answer
108 views

Project Euler #11“numbers in a grid” in Rust

To learn more about Rust, I implemented Project Euler #11 "Numbers in a grid". Contrary to some people, I prefer not having the actual data grid in my code, so I put it in a file, which I read in the ...
26
votes
1answer
626 views

Shift and merge numbers as in 2048 game code

I started to learn Rust last night. Given its parallelization capabilities, I thought a good starting point would be porting my C++ AI for 2048 to Rust. This is the function implementing the shift ...