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):
//! ```rust
//! 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"]);
//! ```

/// Entry macro for the builder-pattern UI DSL.
pub use builderx_macros::bx;
pub use builderx_core::{
    AttachChild, AttachChildren, BxAdapter, CanAttach, CanAttachMany, DefaultAdapter as CoreDefaultAdapter,
};

/// Default adapter chosen by the `gpui` feature; otherwise aliases the core default.
#[cfg(feature = "gpui")]
pub type DefaultAdapter = builderx_gpui::GpuiAdapter;
#[cfg(not(feature = "gpui"))]
pub use builderx_core::DefaultAdapter;

/// Re-export gpui adapter when the feature is present.
#[cfg(feature = "gpui")]
pub use builderx_gpui::GpuiAdapter;