June 2024
Beginner to intermediate
320 pages
8h 59m
English
The builder pattern is a very convenient, fluent way of constructing structs. Because of that, it is omnipresent in Rust code. Often, though, the code required to write a builder is boilerplate—boilerplate that we can automate away! In this chapter, we will write a macro to do just that. Because we are not touching the original struct, we can use a derive macro (remember, go for the simplest option). In an implementation block, we ...
Read now
Unlock full access