{"repo":"elastio/bon","free":true,"listed":false,"github":"https://github.com/elastio/bon","clone":"git clone https://github.com/elastio/bon.git","description":"Next-gen compile-time-checked builder generator, named function's arguments, and more!","language":"Rust","stars":2116,"topics":["asynchronous","builder","builder-pattern","builders","constructor","constructors","data-structures","derive","derive-macro","macro"],"license":"Apache-2.0","category":"dev-tools","readme_excerpt":"📖 Guide Book Narrative introduction 🔍 API Reference Attributes API index Overview bon is a Rust crate for generating compile-time-checked builders for structs and functions. It also provides idiomatic partial application with optional and named parameters for functions and methods. If you wonder \"Why would I use builders?\", see the motivational blog post. Function Builder You can turn a function with positional parameters into a function with named parameters with #[builder] . Any syntax for functions is supported including async , fallible, generic functions, impl Trait , etc. Many things are customizable with additional attributes described in the API reference, but let's see what else bon has to offer. Struct Builder Use #[derive(Builder)] to generate a builder for a struct. Method Builder Associated methods require #[bon] on top of the impl block additionally. Method new The method named new generates builder()/build() methods. #[derive(Builder)] on a struct generates builder API that is fully compatible with placing #[builder] on the new() method with a signature similar to the struct's fields (more details on the Compatibility page). Other Methods All other methods generate {method name}()/call() methods. Methods with or without self are both supported. No Panics Possible Builders generated by bon 's macros use the typestate pattern to ensure all required parameters are filled, and the same setters aren't called repeatedly to prevent unintentional overwrites. If somet","default_branch":null,"files":null,"tree":[],"storefront":"/r/elastio","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/elastio/bon/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}