Skip to main content

Rust Collections

· 11 min read
forfd8960
Author

Rust, known for its focus on memory safety, performance, and concurrency, provides a rich set of data structures in its standard library, collectively known as "collections." These collections are essential for organizing and manipulating data efficiently in your applications. While Vec and HashMap are often the go-to choices for most general-purpose data storage, Rust offers a variety of other specialized collections, each with its own strengths and optimal use cases 2.

This blog post will guide you through Rust's most common collections, explaining their purpose, typical use cases, and providing practical code examples. We'll also touch upon how to use custom hashing algorithms for HashMap and HashSet.

Rust Development with Cargo

· 6 min read
forfd8960
Author

In this guide, we'll walk you through everything from zero to hero with Cargo. Whether you're a Rust newbie dipping your toes or an intermediate dev looking to level up, you'll learn how to harness Cargo's power for efficient, reliable workflows. By the end, you'll be cranking out crates like a pro. Let's dive in!

Rust Utility Traits

· 8 min read
forfd8960
Author

Utility traits in Rust are fundamental traits that provide common functionality across the type system. They enable powerful abstractions and make generic programming more expressive. Let's explore each one with detailed explanations and examples.

Rust Macros

· 4 min read
forfd8960
Author

What is a Rust Macro?

  • Core Concept: Macros are a way of writing code that writes other code, a form of metaprogramming.
  • Compile-Time Expansion: Unlike functions (which are called at runtime), macros are expanded during compilation. The Rust compiler replaces a macro invocation with the code generated by the macro before compiling the rest of the code.

How Rust Trait Works Internally

· 4 min read
forfd8960
Author

Rust's traits are a powerful feature that enables polymorphism and code reuse. Internally, traits are implemented using a combination of static dispatch (monomorphization) and dynamic dispatch (vtable) mechanisms, depending on how they are used. Here's a detailed breakdown of how traits work internally:

Compare Rust and Golang Programming

· 9 min read
forfd8960
Author

In this blog, I will share the programming difference between Rust and Golang, Include:

  • How they use different syntax to declare data type.
  • How rust and golang define the common behavior(interface vs trait).
  • How rust and golang struct to implement the common behavior.
  • What's the difference between rust and golang about Error Handling.
  • How they define complex data type(struct).
  • How they define enum.
  • How they Obtaining and using third-party libraries.
  • What's the difference between rust and golang when write unit test.
  • What's the difference between rust and golang about async programming.