builderx 0.1.0

A concise builder-pattern UI DSL for Rust
Documentation

Facade for the builderx DSL. Re-exports macros, core traits, and toolkit adapters via feature flags so downstream crates can use builderx::bx without wiring adapters manually.

Examples

Build a tree using the default adapter (no UI toolkit required):

use builderx::{bx, AttachChild, AttachChildren};

#[derive(Default, Debug, PartialEq)]
struct Stub(Vec<&'static str>);

impl AttachChild<&'static str> for Stub {
    fn attach_child(mut self, child: &'static str) -> Self {
        self.0.push(child);
        self
    }
}

impl AttachChildren<&'static str> for Stub {
    fn attach_children<I>(mut self, children: I) -> Self
    where
        I: IntoIterator<Item = &'static str>,
    {
        self.0.extend(children);
        self
    }
}

let built = bx! { Stub::default() { "a", ..["b", "c"] } };
assert_eq!(built.0, ["a", "b", "c"]);