First pass at a Rust implementation