In this exercise, we will extend our redis client with protocol buffers functionality.

Preparation + Setup

Step 1
  • Install the protoc compiler (required by prost-build).

  • Create a binary project called redis-client-protobuf: cargo new --bin redis-client-protobuf and add your redis client library as a path dependency.

  • Copy the protobuf definitions to your source directory.


Step 2

Generate Rust protobuf code for phone book and configuration, using prost_build

Step 3

Store and retrieve configuration and phone book entries in Redis.

Step 4

Implement a wrapper around RedisClient that handles encoding and decoding.


Optimize your build so that code generation is only run when the protobuf definitions change.