Back to directory

bon

A Rust crate that generates compile-time-checked builders for structs and functions, plus named and optional function parameters, using the typestate pattern to prevent missing or repeated arguments.

bon

bon is a Rust crate for generating builders for structs and functions, and for turning functions with positional parameters into ones with named, optional parameters. A #[builder] attribute on a function creates a builder-style call with named setters, and #[derive(Builder)] does the same for a struct's fields; both share the same attributes API.

Generated builders use the typestate pattern so that a missing required parameter, or calling the same setter twice, is caught as a compile error rather than a runtime bug. Instance and associated methods are both supported.

It is added as a Cargo dependency and can be used without the standard library or allocator by disabling default features, for no_std environments.

More in Libraries

See all 292
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • TradeCanvas

    bonguynvan.github.io

    A zero-dependency canvas charting engine for building TradingView-style trading charts in JavaScript, with 66 technical indicators, 24 drawing tools, 17 chart types, and real-time streaming.

  • 3d retro graphics

    3d-retro.com

    A free, CC0-licensed library of copy-paste retro 3D and demoscene graphics effects, such as plasma, raytracing, and voxel terrain, runnable as WebGL 1 or plain 2D canvas.