A Challenging Introduction to Rust

Learning a new programming language is rough without using it regularly. When I tried to learn Go a while ago, I struggled because I was not using it a lot. Then I my team at work started using Go and it clicked into place really well. When I decided to pick up Rust, I ran into the same challenge. This time, work wasn’t going to save me. I decided to challenge myself to write all new personal code in Rust.

As part of a college course I’m doing, I have a security and cryptography module this year and I decided to try to write the code for that module with Rust. In some particularly tricky sections, I had to write the code in Python first and then figure out how to convert that into Rust. I’m pretty sure my code isn’t the most perfect, it helped me get a sense for using the language constructs and reading a lot of documentation.

Some useful things I learned

  • Read the docs. Duh. I also enjoyed Rust by example.
  • Clippy helped improve my code into something marginally elegant.
  • Learning to write tests early increased my velocity a lot. The code-edit-run cycles are a lot easier if unit tests do the work for you.

Following a book or a full guide bored me a bit, so this was a nice middle ground and I got to submit this for my assignment. The code is at cipher-suite and I can’t really think of any real world use cases for it. It was fun playing around with it.


Posted

in

by

Comments

Leave a Reply