Building a CSS Parser in Rust 🦀 Coding Session
Join me for an in-depth coding session as I continue building css_structs—my custom CSS parser library written in Rust! In this video, I walk through the architecture and implementation details of parsing CSS declarations, declaration lists, and rules using the Nom parser combinator library. We'll explore the core components of the parser, from handling CSS identifiers and values to building a clean public API with proper error handling. I dive deep into Rust best practices, including implementing traits like Display, writing comprehensive tests, and creating clear documentation for each module. Repository: https://github.com/nikelaz/css-structs 🔥 What I'll Be Working on: ✅ Refactoring my CSSDeclaration, CSSDeclarationList and CSSRule modules for consistency and corectness ✅ Testing and documentation ✅ Clean public APIs and trait implementations ✅ Comprehensive test suites and documentation ✅ Architecture decisions and API design thoughts Perfect for Rust developers interested in parser development, anyone curious about CSS parsing internals, or those wanting to see a real-world Nom parser combinator implementation in action. 📚 Timestamps: 0:00 - Introduction 0:24 - High-Level Overview of the Current Code 2:44 - CSSDeclaration - General Overview 3:13 - Nom - The Parser Combinator Library I'm Using 4:40 - CSSDeclaration - Parsing CSS Identifiers 6:28 - CSSDeclaration - Parsing CSS Declaration Values 6:45 - CSSDeclaration - Parsing the Entire CSS Declaration 7:30 - CSSDeclaration - Crate-Scoped Functions 8:36 - CSSDeclaration - Client API / Public Functions 9:12 - CSSDeclaration - Tests 9:50 - CSSDeclaration - Documentation 11:22 - Thoughts on API and Architecture 11:47 - The Other Modules / Structs 13:53 - CSSDeclarationList - Inspecting the Current Code 16:03 - CSSDeclarationList - The Parsing Function 16:52 - CSSDeclarationList - Error Handling and the from_string Method 19:18 - CSSDeclarationList - The Public and Private Parsing Functions 24:45 - CSSDeclarationList - Other Public API Functions 25:13 - CSSDeclarationList - Implement the Display Trait 29:14 - CSSDeclarationList - Tests and Fixes 44:41 - CSSDeclarationList - Documentation 46:23 - CSSDeclarationList - New Function 48:25 - CSSDeclarationList - Documentation (Part 2) 50:27 - Making Modules Public 51:30 - CSSRule - Inspecting the Current Code 52:15 - CSSRule - Splitting the Parse Method 59:52 - CSSRule - Implement the Display Trait 1:02:20 - CSSRule - Tests 1:07:34 - CSSRule - Documentation 1:10:22 - What's Next 1:11:57 - Conclusion ✉️ Connect: 📧 Email: [email protected] 🐦 Twitter: https://twitter.com/nikelaz 🔗 LinkedIn: https://www.linkedin.com/in/nikola-lazarov
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.