Build with Naz : newtype design pattern, and impl Into T for ergonomic APIs

This video shows how you can use newtype design pattern, and into Impl T. I use an example of building structs to do 2D layout and sizing without using newtype design pattern and demonstrate the pitfalls of using usize everywhere. Then convert it to use newtype pattern, into Impl T, to get all the benefits. Remove entire classes of problems from even existing, thanks to the Rust compiler. For comments and feedback please use these: Repo: https://github.com/nazmulidris/rust-s... Issues: https://github.com/nazmulidris/rust-s... References: https://doc.rust-lang.org/rust-by-exa...    • Jacob Pratt: "Compiler-Driven Development:...   Chapters: 00:00:00 Intro 00:06:04 Ex 1: Using usize for everything and the issues 00:19:35 Ex 2: Use newtype to create core types - X, Y, Width, Height 00:30:28 Ex 3: Use newtype to create Point & Size types 00:39:28 Ex 4: Use into Impl T for X, Y, Width, Height from usize, f64, etc 00:53:05 Ex 5: Use Add to add X & Y to make Point 01:02:05 Ex 6: Allow conversions between Width - X and Height - Y types 01:24:32 Ex 7: Impl Drop and newtype 01:36:00 Outro