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:
- Assertions that must pass for the brick to be valid
- Performance budget that must not be exceeded
- 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§
Sourcefn brick_name(&self) -> &'static str
fn brick_name(&self) -> &'static str
Get the brick’s unique type name
Sourcefn assertions(&self) -> &[BrickAssertion]
fn assertions(&self) -> &[BrickAssertion]
Get all assertions for this brick
Sourcefn budget(&self) -> BrickBudget
fn budget(&self) -> BrickBudget
Get the performance budget
Sourcefn verify(&self) -> BrickVerification
fn verify(&self) -> BrickVerification
Verify all assertions against current state
Returns a verification result with passed/failed assertions.
Provided Methods§
Sourcefn can_render(&self) -> bool
fn can_render(&self) -> bool
Check if this brick can be rendered (all assertions pass)