yew_stdweb/html/component/
properties.rs

1//! Component properties module
2
3pub use yew_macro::Properties;
4
5/// Trait for building properties for a component
6pub trait Properties: Clone {
7    /// Builder that will be used to construct properties
8    type Builder;
9
10    /// Entrypoint for building properties
11    fn builder() -> Self::Builder;
12}
13
14/// Builder for when a component has no properties
15#[derive(Debug)]
16#[doc(hidden)]
17pub struct EmptyBuilder;
18
19impl Properties for () {
20    type Builder = EmptyBuilder;
21
22    fn builder() -> Self::Builder {
23        EmptyBuilder
24    }
25}
26
27impl EmptyBuilder {
28    /// Build empty properties
29    pub fn build(self) {}
30}