wasm_react/props/
classnames.rs1pub trait Classnames {
3 fn append_to(&self, string: &mut String);
5}
6
7impl Classnames for &str {
8 fn append_to(&self, string: &mut String) {
9 string.push_str(self);
10 string.push(' ');
11 }
12}
13
14impl Classnames for String {
15 fn append_to(&self, string: &mut String) {
16 (&self[..]).append_to(string);
17 }
18}
19
20impl Classnames for &String {
21 fn append_to(&self, string: &mut String) {
22 (&self[..]).append_to(string);
23 }
24}
25
26impl<T: Classnames> Classnames for Option<T> {
27 fn append_to(&self, string: &mut String) {
28 if let Some(value) = self {
29 value.append_to(string);
30 }
31 }
32}