Parsing the Redis Serialization Protocol (RESP) in Rust with nom (Part 3)
In this live coding session, we continue our project focused on parsing the Redis protocol in Rust using the nom library. We tackle various data types within the protocol, including bignumber, bulk error, verbatim string, and more complex structures like maps and sets and pushes.
We also did some refactoring along the way to avoid some unnecessary code duplication and we improved our test suite.
This concludes the basic implementation of parsing the Redis protocol. The library might still require some tweaking but that might be the topic of another video!
Chapters:
00:00:00 Intro
00:00:30 Implementing the Bignumber parser
00:16:30 Implementing the Bulk Error parser
00:18:59 Refactoring the parsing of Null values
00:30:51 Implementing the Verbatim String parser
00:39:37 Implementing the Map parser
01:02:39 Implementing the Set parser
01:09:22 Implementing the Pushes parser
01:12:40 Refactoring the parsing of sequences of values
01:17:34 Closing
⛓️ Links:
- Our previous session in the series: https://www.youtube.com/watch?v=ZPdZBHKO4PM
- Our repo (tinyresp): https://github.com/lmammino/tinyresp
- nom documentation: https://docs.rs/nom
- nom combinators cheatsheet: https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md
- nom error management cheatsheet: https://github.com/rust-bakery/nom/blob/main/doc/error_management.md
- nom official examples: https://github.com/rust-bakery/nom/tree/main/examples
- examples from this presentation: https://play.rust-lang.org/?
version=stable&mode=debug&edition=2021&gist=f2db795f7b887f9a2257f950863ee1f5
- The Redis Serialization Protocol (RESP) Spec: https://redis.io/docs/reference/protocol-spec/
➡️ Follow us on Twitch for more live streams at https://twitch.tv/loige
#Rust #Parsing #NOM #RedisProtocol #LiveStream #Twitch #LiveCoding