pub struct CustomWidgetRegistry { /* private fields */ }Expand description
Registry of custom widget configurations.
Implementations§
Source§impl CustomWidgetRegistry
impl CustomWidgetRegistry
Sourcepub fn load_from_json(path: &Path) -> Result<Self, CheckError>
pub fn load_from_json(path: &Path) -> Result<Self, CheckError>
Loads a custom widget registry from a JSON file.
§Arguments
path- Path to the JSON file containing widget configurations
§Returns
A Result containing the registry or a CheckError if loading fails.
§Example JSON format
{
"CustomWidget": {
"allowed_attributes": ["value", "mode", "format"]
},
"DataGrid": {
"allowed_attributes": ["columns", "rows", "sortable"]
}
}Sourcepub fn has_widget(&self, widget_name: &str) -> bool
pub fn has_widget(&self, widget_name: &str) -> bool
Checks if a widget is registered.
Sourcepub fn is_attribute_allowed(&self, widget_name: &str, attribute: &str) -> bool
pub fn is_attribute_allowed(&self, widget_name: &str, attribute: &str) -> bool
Sourcepub fn get_allowed_attributes(&self, widget_name: &str) -> Vec<&str>
pub fn get_allowed_attributes(&self, widget_name: &str) -> Vec<&str>
Sourcepub fn add_widget(&mut self, name: String, config: CustomWidgetConfig)
pub fn add_widget(&mut self, name: String, config: CustomWidgetConfig)
Adds a custom widget configuration.
Trait Implementations§
Source§impl Clone for CustomWidgetRegistry
impl Clone for CustomWidgetRegistry
Source§fn clone(&self) -> CustomWidgetRegistry
fn clone(&self) -> CustomWidgetRegistry
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 CustomWidgetRegistry
impl Debug for CustomWidgetRegistry
Source§impl Default for CustomWidgetRegistry
impl Default for CustomWidgetRegistry
Source§fn default() -> CustomWidgetRegistry
fn default() -> CustomWidgetRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CustomWidgetRegistry
impl RefUnwindSafe for CustomWidgetRegistry
impl Send for CustomWidgetRegistry
impl Sync for CustomWidgetRegistry
impl Unpin for CustomWidgetRegistry
impl UnwindSafe for CustomWidgetRegistry
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