flâneur — a map of the web's best reading

Item 7: Use builders for complex types - Effective Rust

lurklurk.org · 1,473 words · saved by 1 readers

A collection of specific ways to improve your use of Rust

Item 7: Use builders for complex types - Effective Rust Light Rust Coal Navy Ayu Effective Rust Item 7: Use builders for complex types This Item describes the builder pattern, where complex data structures have an associated builder type that makes it easier for users to create instances of the data structure. Rust insists that all fields in a struct must be filled in when a new instance of that struct is created. This keeps the code safe by ensuring that there are never any uninitialized values but does lead to more verbose boilerplate code than is ideal. For example, any optional fields have

Explore this link on the map →

saved by

related reading