favicon here hometagsblogmicrobio cvtech cvgpg keys

I fell in love with Rust

#programming #rust

uncomfyhalomacro | 2024-04-23 | reading time: ~4min

For quite some time, I am getting more interested in programming languages that have good documentation, a large community and accelerating adoption in various sectors in the industry.

Rust came to mind. I just want to write this because there are some things in Rust that actually make sense to me as a language. I might be guilty that I have been influenced by the hype since the start of COVID-19, but after 3 years or so, learning the language, talking with people, reading again the documentation - things have started to make sense and that's why I fell in love with Rust. Here are the whys.

Shared Behaviours§

Although, these concepts are most likely OOP, I never really appreciated OOP in Python. Maybe because of lack of experience? Or interest in the language? Or maybe I just hate Python. I never said I won't be biased in this post so...

Anyway, a shared behaviour in Rust is one of the best things that makes sense to me. These are called traits, and Rust actually stole this from Java's interfaces.

A trait will look like something like this

trait Fruit {
    fn has_seed() -> bool;
}

struct Apple { species: String }
struct Banana { species: String }

impl Fruit for Apple {
    fn has_seed() -> bool {
        true
    }
}

impl Fruit for Banana {
    fn has_seed() -> bool {
        false
    }
}

And it's a very nice addition to Rust. Whoever thought of this is a genius!

Generics§

Rust's generics are one of my favourites. It allows more flexibility and fine-grained control. For example, there are many environments of how a fruit is grown, be it LaboratoryGrown, or Natural.

trait Fruit<Kind> {
    fn has_seed(kind: Kind) -> bool;
}

impl Apple<LaboratoryGrown> {
    fn has_seed(kind: LaboratoryGrown) -> bool {
        false
    }
}

impl Apple<Natural> {
    fn has_seed(kind: Natural) -> bool {
        true
    }
}

Some concepts that took me months to understand§

Who owns who?§

At first, when I was starting with Rust, I didn't understand the ownership system because I don't have experience writing in C or any language that involves pointers and references heavily. However, I self-studied just enough to understand these concepts and it's starting to makes sense! Well to me...

Although, I don't have years of experience writing in C, Rust babysits me teaching me about references and pointers while also protecting me from mistakes like using the same pointer to manipulate data, or doing stupid shit like dropping data from the heap too early.

I am resuming to learn C a few days after this to understand footguns Rust wants me to avoid.

Abstractions pamper me§

Rust just hides away some of the abstraction from you but also shows you that these elisions (thanks firstyear, new word) are not actually hidden. They're just common patterns most would take so elided so that they can be written a little less verbose, and a little less yuck.

Rust ecosystem§

Rust has like many popular crates to choose from. The community loves to curate and makes it way easier to getting started with Rust even for someone like me who still considers himself not a good programmer. I still do think that I am not good but I love to learn cool stuff.

What actually made me fall in love with Rust§

The reason is because of Rust's syntax. I know, someone may already have expected, "oh you love Rust because it's blazingly fast!!!", but the reality is, what got me hooked into Rust the first time was actually its verbose syntax. The first time I tried reading it, its verbosity made me feel comfortable like it's not hiding anything from me. Whereas, in Python, I always feel uncomfortable... I am not sure why, even though I have some experience with it during the Hyperskill beta test by JetBrains of which I completed at least 90% of the beta test.

But yeah, Rust's choice of symbols for its syntax and the feeling of "I am not hiding anything, I can tell you if you ask the right questions" is the reason I fell in love with the language.

BTW, I also heard you like Julia§

Nah... can't hate what I haven't written for a while. I guess packaging Julia is a pain in the ass, that much is true.

Articles from blogs I follow around the net

Suricata evasion, starring URL decoding

These days, one of my favourite hobbies is complaining about Suricata. In this blog, I’m going to talk about some of the weirdness in Suricata when processing URL-encoded data! I’m gonna go into deep detail about one technical aspect of Suricata rule creat…

via GreyNoise LabsJune 05, 2025

What Does It Even Mean To Be “Great” Anyway?

I normally don’t like writing “Current Events” pieces (and greatly prefer focusing on what SEO grifters like to call “evergreen content”), but I feel this warrants it. Content warning: Violence, death, mentions of political extremism. What Does “Great” Mea…

via Dhole MomentsJune 03, 2025

Elevate hover/focus effects with transitions across multiple elements

You can elevate hover/focus effects by triggering transitions on more than one element. With the right orchestration, you can create more nuanced effects.

via Rob O'Leary | BlogJune 01, 2025

Generative AI will probably make blogs better

Generative AI will probably make blogs better. Have you ever searched for something on Google and found the first one, two, or three blog posts to be utter nonsense? That's because these blog posts have been optimized not for human consumption, but rather …

via pcloadletterMay 30, 2025

The everlasting now

Continuing the experiment. My first post in this series was manually crafted, but coding a static almost-a-site generator, without having to worry about all the interrelationships on the old site was quick, & in Rust terms at least, relatively easy. This i…

via Mike KreuzerMay 23, 2025

Web3: The new Scarlet Letter on your resume

A premise about my work experience I have been working as a Software Engineer for over 8 years. In my career I have worked in these sectors and for these amounts of time: Embedded systems on Passenger Information Systems and Access Control Systems: 4…

via Christian Visintin BlogMay 21, 2025

Making a custom porteur bag

I just finished my first fully custom sewing project: a porteur bag for bike trips. This is a bag designed to fit on a front rack, in my case a rack called Jack The Bike Rack. On multi-day trips, I want to bring a change of clothes, and need somewhere to p…

via macwright.comMay 18, 2025

Status update, May 2025

Hi! Today wlroots 0.19.0 has finally been released! Among the newly supported protocols, color-management-v1 lays the first stone of HDR support (backend and renderer bits are still being reviewed) and ext-image-copy-capture-v1 enhances the previous screen…

via emersionMay 14, 2025

The British Airways position on various border disputes

My spouse and I are on vacation in Japan, spending half our time seeing the sights and the other half working remotely and enjoying the experience of living in a different place for a while. To get here, we flew on British Airways from London to Tokyo, and…

via Drew DeVault's blogMay 05, 2025

The Date that wasn't

A tale of lakes, dates and random results.

via Technically PersonalMay 03, 2025

Get Weird And Disappear

Pre-script: Reader and now close friend Phil Giammattei could use some help with a horrible brush with cancer in the family. You can support him here. Update: You all crushed Phil's goal, thank you so much for your generosity. Things are obviously Extremel…

via LudicityApril 29, 2025

Body::poll_progress

This describes a proposal for a cancelation problem with hyper’s request and response bodies. hyper is an HTTP library for the Rust language. Background: what is the Body trait? The Body trait used by hyper is meant to represent a potentially streaming (…

via seanmonstarApril 22, 2025

#Rx Writing Challenge 2025

This is a short reflection on my experience of the recent writing challenge I took part in. Over the past two weeks, I have participated in the #RxWritingChallenge 1—a daily, 30-minute writing group starting at 9 AM every morning. Surrounded by fellow doct…

via Ul-lingaApril 05, 2025

My coffee workflow

My coffee workflow by Clement Delafargue on April 1, 2025 Tagged as: coffee, espresso, flair58, v60. It is my first April cools’ and I guess I could start by talking about coffee. If you’ve seen me in person, it won’t be a surprise, I guess. This po…

via Clément Delafargue - RSS feedApril 01, 2025

LLDB's TypeSystems: An Unfinished Interface

Well, it's "done". TypeSystemRust has a (semi) working prototype for LLDB 19.x. It doesn't support expressions or MSVC targets (i.e. PDB debug info), and there are a whole host of catastrophic crashes, but it more or less proves what it needs to: Rust's de…

via Cracking the ShellMarch 28, 2025

Backup Yubikey Strategy

After a local security meetup where I presented about Webauthn, I had a really interesting chat with a member about a possible Yubikey management strategy. Normally when you purchase a yubikey it's recommended that you buy two of them - one primary and one…

via Firstyear's blog-a-logFebruary 28, 2025

The Adrian Dittmann Story

the evidence, from A to Z, and righting the wrongs

via maia blogJanuary 05, 2025

Awesome Fish functions

Some awesome fish functions that I have accumalated over the years.

via Ishan WritesJanuary 03, 2025

Generated by openring-rs

favicon here hometagsblogmicrobio cvtech cvgpg keys