Rust Code Snippets


Generic Scalar Linear Interpolation (lerp)

A lerp function for any scalar value that implements the below traits.

Generic 1D Complementary Filter

A simple complementary filter that can be used to smoothen noisy signals / inputs.

Basic Finite State Machine

A simple, finite state machine. I strongly recommend using an enum as T.

Basic Queue

A simple, vector-based queue data structure and related behaviors. Use enqueue() to add an element to the end of the queue and dequeue()to remove an element from the front of the queue.

Simple Unit Test

These are basic unit tests in Rust. They often populate the same file as the functions and modules they're built to test. You can run them by executing cargo test in the terminal.