Brick

Trait Brick 

Source
pub trait Brick: Send + Sync {
    // Required methods
    fn brick_name(&self) -> &'static str;
    fn assertions(&self) -> &[BrickAssertion];
    fn budget(&self) -> BrickBudget;
    fn verify(&self) -> BrickVerification;
    fn to_html(&self) -> String;
    fn to_css(&self) -> String;

    // Provided methods
    fn test_id(&self) -> Option<&str> { ... }
    fn can_render(&self) -> bool { ... }
}
Expand description

Core Brick trait - the foundation of the Brick Architecture.

All UI components implement this trait. The trait defines:

  1. Assertions that must pass for the brick to be valid
  2. Performance budget that must not be exceeded
  3. HTML/CSS generation for rendering targets

§Trait Bound

Presentar’s Widget trait requires Brick:

pub trait Widget: Brick + Send + Sync { ... }

This ensures every widget has verifiable assertions and budgets.

Required Methods§

Source

fn brick_name(&self) -> &'static str

Get the brick’s unique type name

Source

fn assertions(&self) -> &[BrickAssertion]

Get all assertions for this brick

Source

fn budget(&self) -> BrickBudget

Get the performance budget

Source

fn verify(&self) -> BrickVerification

Verify all assertions against current state

Returns a verification result with passed/failed assertions.

Source

fn to_html(&self) -> String

Generate HTML for this brick (WASM target)

Returns the HTML string that represents this brick. Must be deterministic (same state → same output).

Source

fn to_css(&self) -> String

Generate CSS for this brick (WASM target)

Returns the CSS rules for styling this brick. Must be deterministic and scoped to avoid conflicts.

Provided Methods§

Source

fn test_id(&self) -> Option<&str>

Get the test ID for DOM queries

Source

fn can_render(&self) -> bool

Check if this brick can be rendered (all assertions pass)

Implementations on Foreign Types§

Source§

impl Brick for Button

Source§

impl Brick for Chart

Source§

impl Brick for Checkbox

Source§

impl Brick for Column

Source§

impl Brick for Container

Source§

impl Brick for DataCard

Source§

impl Brick for DataTable

Source§

impl Brick for Image

Source§

impl Brick for List

Source§

impl Brick for Menu

Source§

impl Brick for Modal

Source§

impl Brick for ModelCard

Source§

impl Brick for ProgressBar

Source§

impl Brick for RadioGroup

Source§

impl Brick for Row

Source§

impl Brick for Select

Source§

impl Brick for Slider

Source§

impl Brick for Stack

Source§

impl Brick for Tabs

Source§

impl Brick for Text

Source§

impl Brick for TextInput

Source§

impl Brick for Toggle

Source§

impl Brick for Tooltip

Implementors§