Rust
Rust is a general purpose, multi-paradigm, systems programming language sponsored by Mozilla. Its goal is to provide a fast, practical, concurrent language with zero-cost abstractions and strong memory safety. It employs a unique model of ownership to eliminate data races.
Solutions to RosettaCode tasks are mirrored on GitHub at Hoverbear/rust-rosetta. If you implement a solution here, please open a pull request!
Features
From the official website:
- zero-cost abstractions
- move semantics
- guaranteed memory safety
- threads without data races
- trait-based generics
- pattern matching
- type inference
- minimal runtime
- efficient C bindings
Tasks
- 100 doors
- 15 Puzzle Game
- 15 puzzle solver
- 2048
- 24 game
- 24 game/Solve
- 4-rings or 4-squares puzzle
- 9 billion names of God the integer
- A+B
- ABC Problem
- AKS test for primes
- AVL tree
- Abbreviations, automatic
- Abbreviations, easy
- Abbreviations, simple
- Abelian sandpile model
- Abstract type
- Abundant odd numbers
- Abundant, deficient and perfect number classifications
- Accumulator factory
- Ackermann function
- Active Directory/Connect
- Active object
- Address of a variable
- Align columns
- Aliquot sequence classifications
- Almost prime
- Amb
- Amicable pairs
- Anagrams
- Anagrams/Deranged anagrams
- Angle difference between two bearings
- Animation
- Anonymous recursion
- Anti-primes
- Append a record to the end of a text file
- Apply a callback to an array
- Apply a digital filter (direct form II transposed)
- Arbitrary-precision integers (included)
- Archimedean spiral
- Arena storage pool
- Arithmetic evaluation
- Arithmetic-geometric mean
- Arithmetic-geometric mean/Calculate Pi
- Arithmetic/Complex
- Arithmetic/Integer
- Arithmetic/Rational
- Array concatenation
- Array length
- Arrays
- Assertions
- Associative array/Creation
- Associative array/Iteration
- Atomic updates
- Attractive numbers
- Average loop length
- Averages/Arithmetic mean
- Averages/Mean angle
- Averages/Median
- Averages/Mode
- Averages/Pythagorean means
- Averages/Root mean square
- Averages/Simple moving average
- Babbage problem
- Balanced brackets
- Banker's algorithm
- Barnsley fern
- Base64 decode data
- Benford's law
- Bernoulli numbers
- Binary digits
- Binary search
- Binary strings
- Bitcoin/address validation
- Bitmap
- Bitmap/Flood fill
- Bitmap/Write a PPM file
- Bitwise operations
- Boolean values
- Box the compass
- Brace expansion
- Bresenham's Line Algorithm
- Brownian tree
- Bulls and cows
- CRC-32
- CSV data manipulation
- CSV to HTML translation
- CUSIP
- Caesar cipher
- Calculating the value of e
- Calendar
- Call a foreign-language function
- Call a function
- Call a function in a shared library
- Call an object method
- Carmichael 3 strong pseudoprimes
- Cartesian product of two or more lists
- Case-sensitivity of identifiers
- Catalan numbers
- Catalan numbers/Pascal's triangle
- Catamorphism
- Chaocipher
- Chaos game
- Character codes
- Check input device is a terminal
- Check output device is a terminal
- Check that file exists
- Chinese remainder theorem
- Chinese zodiac
- Cholesky decomposition
- Church Numerals
- Circles of given radius through two points
- Classes
- Closures/Value capture
- Collections
- Combinations
- Comma quibbling
- Command-line arguments
- Comments
- Compare a list of strings
- Compile-time calculation
- Compound data type
- Concurrent computing
- Conditional structures
- Conjugate transpose
- Constrained genericity
- Constrained random points on a circle
- Continued fraction
- Continued fraction/Arithmetic/Construct from rational number
- Convert decimal number to rational
- Convert seconds to compound duration
- Convex hull
- Copy a string
- Count in factors
- Count in octal
- Count occurrences of a substring
- Count the coins
- Cramer's rule
- Create a file
- Create a file on magnetic tape
- Create a two-dimensional array at runtime
- Create an HTML table
- Create an object at a given address
- Cuban primes
- Cumulative standard deviation
- Currying
- Cut a rectangle
- DNS query
- Date format
- Day of the week
- Deepcopy
- Define a primitive data type
- Delegates
- Delete a file
- Department Numbers
- Detect division by zero
- Determine if a string is numeric
- Determine if only one instance is running
- Digital root
- Dijkstra's algorithm
- Dining philosophers
- Discordian date
- Documentation
- Dot product
- Doubly-linked list/Element definition
- Doubly-linked list/Element insertion
- Draw a clock
- Draw a pixel
- Dutch national flag problem
- Echo server
- Egyptian division
- Element-wise operations
- Elementary cellular automaton
- Elementary cellular automaton/Random Number Generator
- Emirp primes
- Empty directory
- Empty program
- Empty string
- Enforced immutability
- Entropy
- Entropy/Narcissist
- Enumerations
- Environment variables
- Ethiopian multiplication
- Euler method
- Euler's identity
- Euler's sum of powers conjecture
- Evaluate binomial coefficients
- Even or odd
- Events
- Evolutionary algorithm
- Exceptions
- Exceptions/Catch an exception thrown in a nested call
- Execute Brainfuck
- Execute HQ9+
- Execute a system command
- Exponentiation operator
- Exponentiation order
- Extend your language
- Extensible prime generator
- Extract file extension
- Extreme floating point values
- FASTA format
- FTP
- Factorial
- Factors of an integer
- Fast Fourier transform
- Fibonacci n-step number sequences
- Fibonacci sequence
- Fibonacci word
- File input and output
- Filter
- Find common directory path
- Find limit of recursion
- Find the intersection of a line with a plane
- Find the intersection of two lines
- First-class functions
- First-class functions/Use numbers analogously
- Five weekends
- FizzBuzz
- Flatten a list
- Floyd's triangle
- Forest fire
- Fork
- Formatted numeric output
- Four bit adder
- Fractal tree
- Function composition
- Function definition
- Gaussian elimination
- General FizzBuzz
- Generate Chess960 starting position
- Generate lower case ASCII alphabet
- Generate random chess position
- Generator/Exponential
- Generic swap
- Get system command output
- Gray code
- Greatest common divisor
- Greatest element of a list
- Greatest subsequential sum
- Guess the number
- Guess the number/With feedback
- Guess the number/With feedback (player)
- HTTP
- Hailstone sequence
- Hamming numbers
- Happy numbers
- Harshad or Niven series
- Hash from two arrays
- Hash join
- Haversine formula
- Hello world!
- Hello world/Graphical
- Hello world/Line printer
- Hello world/Newbie
- Hello world/Newline omission
- Hello world/Standard error
- Hello world/Text
- Hello world/Web server
- Here document
- Higher-order functions
- History variables
- Hofstadter Q sequence
- Horner's rule for polynomial evaluation
- Host introspection
- Hostname
- Huffman coding
- Hunt The Wumpus
- I before E except after C
- IBAN
- Identity matrix
- Include a file
- Increment a numerical string
- Infinity
- Inheritance/Multiple
- Inheritance/Single
- Input loop
- Integer comparison
- Integer overflow
- Integer sequence
- Interactive Help
- Iterated digits squaring
- JSON
- Jaro distance
- Jewels and Stones
- JortSort
- Josephus problem
- Julia set
- K-means++ clustering
- Keyboard input/Obtain a Y or N response
- Knapsack problem/0-1
- Knapsack problem/Continuous
- Knight's tour
- Knuth shuffle
- Knuth's algorithm S
- LU decomposition
- Langton's ant
- Largest int from concatenated ints
- Leap year
- Least common multiple
- Left factorials
- Letter frequency
- Levenshtein distance
- Levenshtein distance/Alignment
- Linear congruential generator
- Literals/Floating point
- Literals/Integer
- Logical operations
- Longest common prefix
- Longest common subsequence
- Longest increasing subsequence
- Longest string challenge
- Look-and-say sequence
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While
- Lucas-Lehmer test
- Luhn test of credit card numbers
- Lychrel numbers
- MAC Vendor Lookup
- MD4
- MD5
- MD5/Implementation
- Machine code
- Mad Libs
- Magic 8-Ball
- Magic squares of doubly even order
- Magic squares of odd order
- Magic squares of singly even order
- Main step of GOST 28147-89
- Make directory path
- Man or boy test
- Mandelbrot set
- Map range
- Markov chain text generator
- Mastermind
- Matrix chain multiplication
- Matrix multiplication
- Matrix transposition
- Matrix-exponentiation operator
- Maximum triangle path sum
- Mayan numerals
- Maze generation
- Maze solving
- McNuggets Problem
- Memory allocation
- Menu
- Metaprogramming
- Middle three digits
- Miller–Rabin primality test
- Mind boggling card trick
- Minesweeper game
- Modular exponentiation
- Modular inverse
- Modulinos
- Monte Carlo methods
- Monty Hall problem
- Morse code
- Move-to-front algorithm
- Multiple distinct objects
- Multiplication tables
- Munchausen numbers
- Munching squares
- Mutual recursion
- N'th
- N-queens problem
- Nested function
- Nim Game
- Nonoblock
- Null object
- Number names
- Numerical integration
- Object serialization
- Old lady swallowed a fly
- One of n lines in a file
- One-dimensional cellular automata
- Optional parameters
- Order two numerical lists
- Ordered words
- Palindrome detection
- Pangram checker
- Parallel Brute Force
- Parametric polymorphism
- Parse command-line arguments
- Parsing/Shunting-yard algorithm
- Pascal's triangle
- Pattern matching
- Percentage difference between images
- Perfect numbers
- Perfect shuffle
- Permutations
- Pi
- Pick random element
- Playing cards
- Price fraction
- Primality by trial division
- Primorial numbers
- Priority queue
- Probabilistic choice
- Program name
- Program termination
- Proper divisors
- Pythagorean quadruples
- Pythagorean triples
- Quaternion type
- Queue/Definition
- Quine
- RCRPG
- RPG Attributes Generator
- Random number generator (device)
- Random number generator (included)
- Random numbers
- Range expansion
- Range extraction
- Ray-casting algorithm
- Read a configuration file
- Read a file line by line
- Read a specific line from a file
- Read entire file
- Real constants and functions
- Regular expressions
- Remove duplicate elements
- Remove lines from a file
- Rename a file
- Repeat
- Repeat a string
- Return multiple values
- Reverse a string
- Reverse words in a string
- Rock-paper-scissors
- Roman numerals/Decode
- Roman numerals/Encode
- Roots of unity
- Rosetta Code/Count examples
- Rot-13
- Runge-Kutta method
- SHA-256
- Safe mode
- Search a list
- Search a list of records
- Self-describing numbers
- Self-hosting compiler
- Semiprime
- Set
- Shell one-liner
- Short-circuit evaluation
- Show the epoch
- Sierpinski carpet
- Sieve of Eratosthenes
- Simulate input/Keyboard
- Simulate input/Mouse
- Singly-linked list/Element definition
- Singly-linked list/Element insertion
- Singly-linked list/Traversal
- Sleep
- Smith numbers
- Sockets
- Sort a list of object identifiers
- Sort an array of composite structures
- Sort an integer array
- Sort stability
- Sort using a custom comparator
- Sorting algorithms/Bogosort
- Sorting algorithms/Bubble sort
- Sorting algorithms/Counting sort
- Sorting algorithms/Heapsort
- Sorting algorithms/Insertion sort
- Sorting algorithms/Merge sort
- Sorting algorithms/Pancake sort
- Sorting algorithms/Quicksort
- Sorting algorithms/Selection sort
- Sorting algorithms/Sleep sort
- Sorting algorithms/Stooge sort
- Sparkline in unicode
- Spinning rod animation/Text
- Split a character string based on change of character
- Stack
- Statistics/Basic
- String append
- String case
- String comparison
- String concatenation
- String interpolation (included)
- String length
- String matching
- String prepend
- Strip a set of characters from a string
- Strip comments from a string
- Strip whitespace from a string/Top and tail
- Substring
- Sudoku
- Sum and product of an array
- Sum data type
- Sum digits of an integer
- Sum multiples of 3 and 5
- Sum of a series
- Sum of squares
- Sutherland-Hodgman polygon clipping
- Synchronous concurrency
- Take notes on the command line
- Taxicab numbers
- Terminal control/Clear the screen
- Text between
- The Twelve Days of Christmas
- Thue-Morse
- Tokenize a string
- Tokenize a string with escaping
- Totient function
- Trabb Pardo–Knuth algorithm
- Tree traversal
- Two Sum
- Type detection
- URL decoding
- URL encoding
- Ulam spiral (for primes)
- Unbias a random generator
- Unicode variable names
- Unix/ls
- Untrusted environment
- Validate International Securities Identification Number
- Vampire number
- Variable size/Get
- Vector
- Vector products
- Vigenère cipher
- Visualize a tree
- Walk a directory/Non-recursively
- Walk a directory/Recursively
- Water collected between towers
- Word break problem
- Word frequency
- Write entire file
- XML/Output
- Y combinator
- Zero to the zero power