pub struct WidgetSchema {
pub required: &'static [&'static str],
pub optional: &'static [&'static str],
pub events: &'static [&'static str],
pub style_attributes: &'static [&'static str],
pub layout_attributes: &'static [&'static str],
}Expand description
Represents the validation contract for a single widget type.
Contains lists of valid attributes categorized by type (required, optional, events, etc.).
§Examples
use dampen_core::schema::WidgetSchema;
let schema = WidgetSchema {
required: &["value"],
optional: &[],
events: &[],
style_attributes: &[],
layout_attributes: &[],
};
assert!(schema.all_valid().contains("value"));Fields§
§required: &'static [&'static str]Attributes that MUST be present on the widget.
optional: &'static [&'static str]Attributes that MAY be present on the widget.
events: &'static [&'static str]Event handler attributes (e.g., “on_click”).
style_attributes: &'static [&'static str]Styling attributes (e.g., “background”, “color”).
layout_attributes: &'static [&'static str]Layout attributes (e.g., “width”, “padding”).
Implementations§
Source§impl WidgetSchema
impl WidgetSchema
Sourcepub fn all_valid(&self) -> HashSet<&'static str>
pub fn all_valid(&self) -> HashSet<&'static str>
Returns a HashSet containing all valid attributes for this schema.
This combines required, optional, events, style, and layout attributes.
Sourcepub fn all_valid_names(&self) -> Vec<&'static str>
pub fn all_valid_names(&self) -> Vec<&'static str>
Returns a Vec containing all valid attribute names.
Trait Implementations§
Source§impl Clone for WidgetSchema
impl Clone for WidgetSchema
Source§fn clone(&self) -> WidgetSchema
fn clone(&self) -> WidgetSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WidgetSchema
impl Debug for WidgetSchema
Source§impl PartialEq for WidgetSchema
impl PartialEq for WidgetSchema
impl Copy for WidgetSchema
impl Eq for WidgetSchema
impl StructuralPartialEq for WidgetSchema
Auto Trait Implementations§
impl Freeze for WidgetSchema
impl RefUnwindSafe for WidgetSchema
impl Send for WidgetSchema
impl Sync for WidgetSchema
impl Unpin for WidgetSchema
impl UnwindSafe for WidgetSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more