pub struct TestComponent {
pub name: String,
pub html: String,
pub classes: HashSet<String>,
pub custom_properties: HashMap<String, String>,
}Expand description
A test component with metadata
Fields§
§name: String§html: String§classes: HashSet<String>§custom_properties: HashMap<String, String>Implementations§
Source§impl TestComponent
impl TestComponent
Sourcepub fn new(name: impl Into<String>, html: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, html: impl Into<String>) -> Self
Create a new test component
Sourcepub fn add_classes(&mut self, classes: impl IntoIterator<Item = String>)
pub fn add_classes(&mut self, classes: impl IntoIterator<Item = String>)
Add multiple classes to the component
Sourcepub fn add_custom_property(
&mut self,
property: impl Into<String>,
value: impl Into<String>,
)
pub fn add_custom_property( &mut self, property: impl Into<String>, value: impl Into<String>, )
Add a custom property to the component
Sourcepub fn get_classes(&self) -> Vec<String>
pub fn get_classes(&self) -> Vec<String>
Get all classes as a vector
Sourcepub fn get_classes_string(&self) -> String
pub fn get_classes_string(&self) -> String
Get all classes as a string
Sourcepub fn get_custom_property(&self, property: &str) -> Option<&String>
pub fn get_custom_property(&self, property: &str) -> Option<&String>
Get a custom property value
Sourcepub fn get_custom_properties(&self) -> &HashMap<String, String>
pub fn get_custom_properties(&self) -> &HashMap<String, String>
Get all custom properties
Trait Implementations§
Source§impl Clone for TestComponent
impl Clone for TestComponent
Source§fn clone(&self) -> TestComponent
fn clone(&self) -> TestComponent
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 moreAuto Trait Implementations§
impl Freeze for TestComponent
impl RefUnwindSafe for TestComponent
impl Send for TestComponent
impl Sync for TestComponent
impl Unpin for TestComponent
impl UnwindSafe for TestComponent
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