Dev (@_dev14325) header
Dev (@_dev14325) profile picture

Web3

Chandigarh , India
Joined December 2023
covering essential Rust concepts : ✅ Memory safety & ownership ✅ Error handling & Option types ✅ Pattern matching with enums ✅ Generic programming ✅ Traits & polymorphism ✅ Collections (HashMap, Vector) ✅ String manipulation
15
🚀 Mastering Rust's Consuming and Iterator Adapters! 1/n 🔥 What are Iterator Adapters? Iterator adapters transform an iterator to create a new iterator. They do not consume the iterator instead they "adapt" it by applying some transformation.
1
30
🤔 When to Use What? Use iterator adapters when you want to "build a pipeline" of transformations. Use consuming adapters when you’re done with the iterator and need to get a result.
1
26
💡 Your Turn! Try to combine iterator and consuming adapters in a single pipeline. Can you create a one-liner that filters out odd numbers, doubles the even numbers, and sums them up? 🤔 Solution :
24
🚀 Rust's Result & Option: Powerful Error Handling & Null Safety 🦀 Rust's Result and Option enums are game-changers for writing safe, reliable code! No more null pointer exceptions or unexpected crashes. Here’s how I used them in real-world scenarios:
1
19
1. Using Result for File Handling with Errors Handle file reading and parsing with custom errors: 2. Using Option to Safely Return None or a Value Find the first uppercase letter in a string:
12
🚀 Mastering Rust Option Handling: Hey everyone! I've been working on Rust's Option<T> and how to safely access characters in a string without triggering runtime panics. Rust’s strict ownership and type system might seem tough at first, but trust me, it’s good for the safety
1
13
Why ✅ Safer Approach 1 Works: We explicitly handle both Some(c) and None, so there’s no chance of a panic. Rust enforces exhaustive pattern matching, so you’ll never forget to handle the None case.
1
14
Why ✅ Safer Approach 2 Works : If nth(10) returns None, unwrap_or(' ') will return a default character instead of panicking. This is super useful if you just want to avoid the panic but still get a usable result.
13
Mastering Ownership in Rust — No More Dangling Pointers or Double-Free Errors! 💪🦀 Hey everyone! I've been exploring Rust's ownership system, and I wanted to share a simple yet powerful concept that demonstrates how Rust prevents common memory issue
1
17
Here’s a sneak peek of my code, where I showcase: 🔹 Moving Ownership — How one variable transfers ownership to another. 🔹 Function Ownership — How Rust manages ownership when passing values to functions. 🔹 Ownership Return
14
I’ve developed and deployed a Token Sale system on the Sepolia Testnet ! Here’s a quick summary of what I’ve built: ERC-20 Token (erc20.sol): Created a custom token MTK (3,000,000 tokens minted initially), designed for distribution in both presale and public sale phases.
1
54
🔑 Next Steps: Refund & Claim Functionality : I will soon implement functions that will allow users to: # Claim Tokens if the sale is successful. # Claim Refunds if the sale does not reach the minimum cap.
1
29
Contributions and token allocations are being tracked, but the tokens will not be transferred immediately to ensure the refund process works properly if needed.
23