mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
585: Add own Classes struct implementation r=DenisKolodin a=DenisKolodin Hide details of Classes set implementation and add a feature to produce that struct from variety of sources like `&str`, `String` and `Vec<T> where T: AsRef<str>`. I need this to have an effective way to construct complex classes set for https://github.com/yewstack/facade. With this PR we can do something like: ```rust let mut classes = vec!["container"]; classes.push("fluid"); // or let mut classes = Classes::new(); classes.append("container"); if fluid_flag { container.append("fluid"); } html! { <div classes=classes /> } ``` In the future we can implement `impl Info<Classes> for (tuple)` and simplify macro by delegating **tuples to classes** conversion to type system (instead of macro). Let's give a chance to CI to check it 🤞 Also I applied `cargo fmt` to the root crate sources. Co-authored-by: Denis Kolodin <deniskolodin@gmail.com>