Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

39 Commits

Folders and files

Repository files navigation

Rust Journal

This journal has a growing collection of magic code and patterns that I found during my journey of learning Rust

Note

This project is inspired by the GitHub repo Rust Magic Pattern.
I recommend checking it out!

Sometimes it gets very tedious to get muliple Flags as paramaters in a function/method.
But Bitflags help to handle that scenario in a very simple (from the user perspective) and elegant way.

Bitflags::Are | Bitflags::You | Bitflags::Interested

One of my favourite coding patters are State Machines.
But not just any State Machine. You can implement the State Machine pattern in Rust in such a way to have compile time checks at state transitions.

Sounds interesting huh?

One of the most powerful architectural patterns in Rust is the Super Typestate.
But it goes way beyond just state transitions. You can use traits and Zero-Sized Types to dynamically morph a struct's data fields and behavior entirely at compile time.

Ready to write foolproof APIs?

I found an amazing design pattern in the populare crate Notify. It allows a function to accept a closure and a Channel Sender (just an example) at the same time!

You may wonder if this is possible?

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages