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

8
votes
1answer
101 views
+100

Log sorting program

This is my first ever program written in Rust (after reading the book). It is small tool to sort all lines from stdin according to two criteria. First one is time ...
1
vote
0answers
46 views

Edit distance (Optimal Alignment) - follow up

This is a follow up of this question Optimal substructure of ED: Here is the reasoning behind my solution: let \$x = (\alpha _{1},\alpha _{2},\alpha _{3},...,\alpha _{m})\$ and \$y = (\beta_{1},\...
3
votes
0answers
20 views

Heap sort in Rust

The tests are taken from this answer on an insertion sort in rust question. The algorithm is taken from Algorithms in a Nutshell (2nd Edition). I'm not looking at crazy performance, the goal being ...
4
votes
2answers
97 views

Edit distance implementation

This problem is taken from the book Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein: In order to transform one source ...
1
vote
0answers
238 views

Backtracking Sudoku solver in Rust

A Sudoku solver with an approach similar to my previous post. ...
-1
votes
0answers
30 views

A back-tracking algorithm for the 8 queens game

The goal is to place 8 queens on a chess board so that each of them is safe. The algorithm explores each row of the chess board to find a valid position as soon as possible. When it occurs that a ...
2
votes
0answers
35 views

Divide-and-conquer approach for finding the closest pair of points

This is an algorithm for finding the closest pair of points on a 2d plane by dividing the problem by half recursively, as illustrated here: ...
1
vote
1answer
275 views

Insertion sort in Rust

Here is the code: ...
0
votes
0answers
579 views

Needleman–Wunsch algorithm in Rust

The Needleman–Wunsch algorithm is an algorithm used in bioinformatics to align protein or nucleotide sequences. Here is an implementation in Rust: ...
0
votes
1answer
166 views

Divide and conquer approach in search for max element, take 2

Adopted some suggestions from the answer of my previous post. Here is the code: ...
0
votes
1answer
169 views

Divide and conquer approach in search for max element

Continuing the Algorithm in a Nutshell series, here is the code: ...
1
vote
0answers
332 views

Graham scan from Algorithms in a Nutshell in Rust

Continuing the Algorithm in a Nutshell series, here is the code: ...
3
votes
1answer
99 views

Naive convex hull from Algorithms in a Nutshell book

I am working through the book Algorithms in a Nutshell by George T. Heineman and trying to translate the pseudocodes into Rust. Here is a naive convex hull algorithm: ...
2
votes
1answer
60 views

Rust sorting algorithms (selection, bubble, quick, shell, merge)

I have written some sorting algorithms in Rust and wanted to see how terrible they were. What I am looking for: Bugs Performance improvements Idiomatic code Maybe even a functional approach to the ...
2
votes
1answer
223 views

Z^m number system in Rust version 2

A Z^m number system includes integers in the interval [0, m) when m > 0 or (m, 0] when m < 0. The code defines a trait Mod to represent numbers in this system ...
2
votes
1answer
663 views

Z^m number system in Rust

A Z^m number system includes integers in the interval [0, m) when m > 0 or (m, 0] when m < 0. The code defines a trait Mod to represent numbers in this system ...
3
votes
1answer
45 views

Check whether two strings are anagrams

Inspired by Monday's Reddit daily programmer challenge, I wrote a function to check whether two strings are anagrams. It doesn't take the same input as the challenge, though, since I don't want to ...
4
votes
1answer
56 views

Rust Console RPN Calculator

I've been trying to teach myself Rust, and I decided that a simple console calculator would be a good project to learn from. ...
3
votes
0answers
40 views

Rust publish/subscribe channel library

I've written a simple multiple-sender multiple-receiver channel, but I'm unsure if my approach is the best way to do this. I'm not using multi-threaded primitives but instead wrapping around std's ...
4
votes
1answer
59 views

Asynchronous database query system using futures-rs in Rust

Background I've been working on an algorithmic trading platform in Rust and utilizing the newly released futures-rs library to keep everything asynchronous and non-blocking. One issue I've come ...
4
votes
1answer
43 views

Rusted Mandelbrot

As my go to first project for a language is a Mandelbrot, I had to implement one in Rust. I'm particularly annoyed by invalid_arg_count, as I feel like there has to ...
2
votes
1answer
35 views

Google Codejam 2016 Round 3 Problem A

I'm learning Rust by completing a variety of coding challenges, such as the Google Codejam problem stated in the title. I completed a Python 3 implementation that I liked, which I then tried to port ...
7
votes
1answer
75 views

A Rusty implementation of CowSay

I'm making my first foray into Rust. I wanted to copy a fun and non utilitarian tool so I chose CowSay. It's not feature complete (CowSay has a lot of options) but it's a start. My primary reasons ...
2
votes
1answer
45 views

Cookie, Session, and Flash middleware for Iron framework

Iron's cookie and session middleware projects seem to be abandoned. I've put together implementations for them, along with a ...
1
vote
0answers
63 views

AVL Tree implementation in Rust

I'm mainly looking for tips in how make my code more idiomatic and elegant, but any general reviews are welcome. ...
2
votes
2answers
64 views

Rust function to read the first line of a file, strip leading hashes and whitespace

I’m writing a Rust function for getting a title based on the first line of a file. The files are written in Markdown, and the first line should be a heading that starts with one or more hashes, ...
2
votes
1answer
60 views

Rust cows and bulls

I just wrote a cows and bulls implementation in Rust. It seems a little large. Are there any changes I could make while still keeping it easily readable? ...
3
votes
1answer
44 views

Read file contents to string safely

I've just started to teach myself Rust. I've written the following code to read a text file and store the contents in a String. Is this the typical way of doing ...
1
vote
0answers
19 views

Wrap glium_text so that parameters aren't passed redundantly

I was annoyed by the API of glium_text, so I decided to make a wrapper that cleans up the API instead of coding my own text rendering. (I might do that later.) The wrapping turned out to be rather ...
6
votes
1answer
143 views

Binary Tree Implementation in Rust

To teach myself Rust, I implemented a naive binary tree with support for insert, delete and lookup operations as well as in-order iteration. I'm still a little rusty (no pun intended) when it comes ...
3
votes
2answers
69 views

X-up utility for EVE Online

I am learning Rust. I also play EVE Online – a video game about internet spaceships. I decided that it would be fun to practice Rust by writing a simple utility to help me x up. to x up (verb) ...
7
votes
1answer
100 views

A rusty Bit Vector library

As an exercise to learn Rust I've decided to write a Bit Vector library, furthermore I also intend to use it later because my version can share slices of the bit vector between threads whereas the ...
5
votes
0answers
38 views

Multiple rusty Sieves of Eratosthenes

To get more familiar with the multi-threading aspects in the Rust language I decided to multi-thread my earlier implementation of The rusty Sieve of Eratosthenes. I have to say that it is probably in ...
6
votes
2answers
95 views

Implement a generic Fibonacci sequence in Rust without using Copy trait

I'm trying to learn Rust and am a beginner. How does one go about implementing a generic version of the Fibonacci sequence without using Copy trait in Rust? My code ...
6
votes
1answer
119 views

The rusty Sieve of Eratosthenes

To get familiar with the Rust language I've decided to implement the method of Sieve of Eratosthenes to find primes up to a number N. I have created the following code that both prints the prime ...
3
votes
1answer
57 views

A socket server that receives strings and prints them

Summary: Is my server handling every error and corner case possible? If not, what did I miss? Details I'm trying to write the most basic socket server I can, so I can learn TCP and the pitfalls of ...
4
votes
1answer
55 views

A simple register VM written in Rust

I'm teaching myself Rust, and to do this I've written a toy register based virtual machine. I hope the code is easy to follow - I just want to know if there are any mistakes I am making with the ...
8
votes
1answer
144 views

Calculating word-wise CRC

This is a small program to calculate the CRC for an STM32 program image, compatible with the CRC on the STM32 hardware. It's a word-wise CRC, and the bin file is encoded as a series of 32 bit little ...
1
vote
1answer
44 views

Speed-Distance-Time Calculator in Rust 1.8

Whenever I try a new language I always try to write a speed-distance-time calculator as well as possible. I did this with C++ a while ago now. This is a similar question but this time in Rust. The ...
3
votes
1answer
40 views

Writing a Rustic segmented prime number sieve

I wrote a prime number sieve in Ruby last year as part of a coding challenge, but lately I wanted to port it to Rust. I finally got around to it, but it's still intensely Rubinic. Before I take the ...
4
votes
1answer
99 views

Simple virtual machine in Rust

About I'm trying to implement a simple virtual machine. Now it supports only three operations: ADD(reg0, reg1, reg2) -> reg0 = reg1 + reg2 ...
1
vote
2answers
97 views

Simplest way to write “FizzBuzz” in Rust

Can you write an a simpler Rust fizzbuzz program than I have? Use my output or the spec: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of ...
2
votes
2answers
193 views

Idiomatic word counting in Rust

My goal is to read from standard input, break up the input into words, case-insensitively, and produce a report to standard output, where each line is a word followed by a space followed by its count. ...
4
votes
1answer
28 views

Extract PNGs embedded in a file

My approach was to find each occurrence of the PNG's file signature followed by its end of file (EOF) and write the bytes between to a new file whose name is simply a counter starting at zero. ...
5
votes
1answer
102 views

K-means clustering in Rust

I've implemented K-means clustering in Rust. It's my second Rust project (my first one is here: Randomly selecting an adjective and noun, combining them into a message) I would like advice on ...
4
votes
0answers
67 views

Simple graph in Rust

I have written simple code to construct a graph, but I think there are too many different types for such a simple task. In this code I need to store Node structs ...
1
vote
1answer
108 views

Simple type-safe and thread-safe Rust event system

I'm creating a relatively simple type-safe and thread-safe Rust event system. It is to be used with and within an IRC library I'm making, but should work just fine for other use-cases. It needs to be ...
6
votes
1answer
49 views

Randomly selecting an adjective and noun, combining them into a message

This is my first Rust program. I have previously written a lot of Python, and some C. I would like some advice on whether I am doing things idiomatically, and any improvements I could make! I also ...
3
votes
0answers
48 views

Easy error handling

I've started using the following Error configuration for some simple libraries I've been working on: ...
4
votes
1answer
428 views

A Rust iterator to match and replace subsequences

I needed to do transformations on a data stream, not on an element-by-element basis, but on subsequences. This is what I've come up with: https://github.com/peterjoel/rust-iter-replace/blob/master/src/...