moddedBear

Sticky Notes and Learning Rust

I got another itch to do some hobby programming this week, but to make things interesting I decided why not try to see what Rust is all about?

Yet Another CLI Note Manager

I settled on writing a command line note/to-do manager both for its simplicity and because it's something I knew I would actually use often once it was completed.

My main goal, other than learning Rust, was to find a really good balance between simplicity and functionality. For me the note analogy that works best is that of putting sticky notes around your monitor and workspace, so I've named the project "Sticky". I like notes that are highly visible and that I'm always reminded of. This gives me a good reason to do whatever it is I need to say "I don't need this note any more" and get rid of it. I also dislike when note management becomes a task in itself. Having to worry too much about prioritization and organization can end up discouraging me from keeping notes at all.

So with Sticky you can view your list of notes, add notes, remove notes, mark notes as completed, and clear out completed notes. Notes are stored in a single plain text file for simplicity which also happens to make things easier for anyone who might want to make batch or programmatic edits.

As I wrote earlier, I like always being reminded of my notes. I've added Sticky to my shell config so it displays my notes every time I open a new terminal, and I've also modified my shell's clear screen keybinding so my notes will be displayed after I clear my terminal screen.

The code is on GitHub and I've published Sticky to crates.io in case it sounds useful to anyone other than me. There's nothing too elegant about the code. It is a first Rust project after all. I'll probably go through and clean it up a bit later since this is something I want to keep using and supporting.

https://github.com/moddedBear/sticky

General Impressions of Rust

I like Rust. I slightly prefer it to C, which is the language I have experience with that seems to be the most similar.

One thing you'll always hear about from Rust fans is memory safety. Rust checks for memory safety at the compiler level so in theory as long as your program compiles you shouldn't have to worry about running into any odd bugs that spring up from bad memory management. In response I've heard braindead takes like "well just write good C code and it doesn't matter". Rust's memory safety is a great feature not just because it saves you from making memory management mistakes, but also because by doing so it makes system programming more accessible and helps newer programmers understand good and bad practices.

Something else that impressed me was Rust's documentation. I went through the most important bits of the Rust by Example book before starting to write any code and it was super helpful. Rust's compiler is deserving of some praise too. It has some of the most helpful compiler messages I've seen, even linking directly to documentation in every case that I saw.

So overall, Rust would likely be a fine language to learn even if you're someone who's unfamiliar with systems programming concepts. From now on I expect it'll be my systems programming language of choice.

- moddedBear / 2022-06-23

Home