16. Testing
In JavaScript/TypeScript, testing is a whole ecosystem: Jest/Vitest/Mocha as runners, Chai/Expect for assertions, Istanbul for coverage, maybe ts-jest for transpilation. Configuring jest.config.js ...
In JavaScript/TypeScript, testing is a whole ecosystem: Jest/Vitest/Mocha as runners, Chai/Expect for assertions, Istanbul for coverage, maybe ts-jest for transpilation. Configuring jest.config.js ...
If you’re used to the NPM ecosystem and ES modules, you might think “module” = file and “package” = folder in node_modules. In Rust, the same ideas exist for compile performance and strict boundari...
As a TS developer you’re used to try/catch. It works well on V8, but it has a big downside: errors are invisible. You can’t tell from a signature like fn readFile(path: string): string that the fun...
This is a Rust async/await guide tailored for experienced TypeScript developers. As a senior TS developer you know the Event Loop, Promises, and the microtask queue. Rust’s async model is fundamen...
Now that you have Struct (space) and Trait (behavior), we focus on the third piece of Rust’s type system—and the hardest: Time. This is the biggest conceptual wall for TS developers. In TS, “time”...
8. Returning traits (impl Trait) 8.0 Why can’t we return -> Trait directly? Suppose you have two structs: struct Button (100 bytes) struct Label (20 bytes) Both implement the Draw trai...
This is a Rust Trait guide tailored for experienced TypeScript developers. You might think a Trait is just an interface. If you use it only that way, you’re using a small part of Rust. In Rust, tr...
This is a Rust structs guide for experienced TypeScript developers. In TypeScript we work with Object, Interface, and Class every day. You might think a Rust struct is just an Object with another ...
This is a Rust enums and pattern matching guide for experienced TypeScript developers. As a TS developer you may have a love-hate relationship with TS enum: it’s a runtime object, sometimes compil...
For JS/TS developers, these are usually separate: if is a “statement” for control flow, 1+1 is an “expression” for computation. Rust inherits from functional languages (Haskell, Scala, etc.): contr...
This is a Rust common collections guide tailored for experienced TypeScript developers. In TypeScript/JavaScript you mainly have Array (list, stack, queue) and Object/Map (key-value). V8 does a lo...
Rust’s strings are so different from TS that we devote a separate chapter to them. Strings: Buffer vs View In TS/JS (V8), string is a black box. You write const s = "hello" + "world"; V8 might op...
Since we’re already familiar with V8’s behavior, the event loop, and TypeScript’s structural type system, we’ll skip programming basics and go straight to Rust’s core design. We’ll use The Rust Pro...
Rust’s top-level design doesn’t come from industry patches (like Java adding GC to address C++ pointer issues); it comes from type theory and mathematical logic. To really understand Rust’s “way,”...
As experienced full-stack JavaScript/TypeScript developers, we’re used to the V8 engine managing memory behind the scenes and to TypeScript’s flexible structural type system. To understand Rust fr...
This cheat sheet is designed for TypeScript developers, aiming to help you map your existing knowledge to Rust syntax. 1. Variables & Mutability In TS, const means the reference is immutable,...