The Rust Review: Enhancing Rust Development with ChatGPT: A Dual-Role Journey from Work to Learning

4 min

Welcome back to our Rust Review series! In this third instalment, we're thrilled to introduce Colin Rhys, a seasoned Rust full-stack contractor with expertise in Actix-web API and React front-end development. Formerly one of the first ten developers at a groundbreaking crypto accounting startup, Colin has a wealth of experience.


In this edition, we'll accompany Colin on a distinctive journey where he leverages ChatGPT to enhance his Rust development experience. Discover how Colin utilises ChatGPT in his dual-role journey — seamlessly transitioning from work to a continuous learning environment. Join us for a captivating exploration of real-world applications, the challenges of full-stack contracting, and the evolving landscape of web technologies.



Getting into Rust

 

I heard about Rust in 2020 from a recruiter who said, "The smartest person I know said this is going to be the next big thing." I googled "Rust" and got a result for the video game, and then I googled "Rust the computer language" and promptly forgot about it.

 

I kept hearing about Rust (the computer language) on Twitter, online, and then from other developer friends. I took a more in-depth look into Rust in 2021 because, at this point, I was really curious. I read through the Wikipedia page and then looked through other online message boards. I was instantly hooked on it being a new language and the amount of thought that went into its design. The amount of thought that went into creating the Rust language, the intent with the goals associated with the design, and the number of things people were developing within the Rust community online were incredible.

 

From looking through different cargo crates, API frameworks like Rocket and Actix-Web (my favorite), and front-end libraries like Yew.rs online. I knew I wanted to try out some of these outside of work.  

 

After my initial Rust research online, I started doing what I have done since college when I taught myself Python. I had been going to campus on Sunday at 8 in the morning to use the Bloomberg terminal to play around with backtesting different stock trading strategies. Then I learned about Quantopian, which could do the same thing as a Bloomberg terminal with one cache. It had no graphical user interface. You had to script your strategies in Python. So, I taught myself how to code in Python.

 

I looked through official documentation like the Rust Cookbook, read blog posts, watched YouTube videos, and played around with what I learned on LeetCode and CodeWars. I then started building simple projects using Rocket, initially with Diesel as the ORM. I talked to other developer friends about how cool I thought Rust was and continued to read about it online.

 

More Than Just the Docs

 

Then, I started building a simple project, first a CRUD functionality API with Rocket and Diesel as the ORM. I learned a lot through this but was naturally still reading through tutorials online and looking up different frameworks.

 

ChatGPT becomes popular

 

Then, everyone at work, my developer friends, and even my non-developer friends started talking about ChatGPT. I started playing around with it and thought it was terrific. It could give me the same sort of information I would google about a historical event or the author of a book I was reading quicker than a Google search and with more detail. Then I started asking it to do simple things for coding stuff on things I was working on outside of work, like creating different Rust structs with a provided list of variables and types. I saw that it could also do this quicker. It could write things out faster than me and remove a chance of human error on a spelling error. I instantly saw it as a great aid in work.

 

Asking ChatGPT for More

 

I started bouncing ideas off of it for design stuff, simple things like "Does this make sense?" with some sudo code and "What is a different way to do X." I saw that I could use it for more than just concise, quick answers to historical facts and creating Rust structs.

 

Then, I got laid off unexpectedly at the beginning of this year. The startup market and the entire tech sector were taking a real hit. I asked recruiters I liked and had worked with in the past about the hiring market, and they did not seem too upbeat. So I started looking around for contract work, thinking that it would be a great way to not only earn money but also to get some professional experience in my new favorite language, Rust. At this point, I had created more than just CRUD functionality APIs, decided Actix-Web was better than Rocket, and developed a new appreciation for Postgres from using Diesel ORM.

 

I eventually found some contract work with a friend who had his own recruiting firm and other Rust-focused stuff on the side. Also, not always having daily team standups to bounce ideas off people and talk about different pain points in whatever I was working on, I started "talking" more with ChatGPT about my code. I started writing out design ideas or how I planned to implement code with ChatGPT as my sounding board. I found that it felt more and more like having a conversation with a teammate. With ChatGPT 4, I also noticed an improvement in answers.

 

I now use ChatGPT to bounce ideas off of as a first place to ask for a reference for a Rust or other coding-based question before googling my problem or going to Stack Overflow. I still look at the documentation, but ChatGPT's ability to provide actual code examples is beneficial and very tangible in its ability to help me quickly understand what I am asking about.

 

I have also found that it iterates my ability to learn quicker and get unstuck faster by simply putting the error code I am getting and the code into a prompt and saying, "Can you explain this to me." Often, the answers are spot on, and even if not, it keeps me moving and not just staring at the screen or rereading the error message.

 

Continuing to Learn with ChatGPT

 

I continue to use ChatGPT to learn and improve my skills outside of work by using it as a reference and to talk through different solutions to algorithm challenges. I use ChatGPT as my first place to ask questions about something I want to understand more about. I also use ChatGPT to help me practice coding algorithms after submitting an answer online; I also use ChatGPT to talk about different solutions to algorithm challenges. You can just paste your code and another answer someone else submitted into a prompt window and ask it anything you want about your submission and another. ChatGPT has made me more effective at work, iterated my ability to learn a new language faster, and increased my depth of knowledge on the topic. It's a far cry from spending a week googling one thousand questions to get a Python script in Quantopian to run.

 

I continue to enjoy learning more and more about Rust and using it as the primary language in my day-to-day coding at work and outside of work. Using ChatGPT has helped me be more efficient at work, more detailed in my thinking before starting to code, and in learning more about Rust. I have learned more in a shorter time using ChatGPT and increased my efficiency at work. I am excited to continue to use it at and away from work to learn new things, whether it be Bitwise Operators in Rust or reference questions about a book I am reading.