futursolo / stylist-rs

A CSS-in-Rust styling solution for WebAssembly Applications
https://crates.io/crates/stylist
MIT License
366 stars 22 forks source link

the trait bound `StyleSource: From<&str>` is not satisfied #117

Closed superuserme closed 1 year ago

superuserme commented 1 year ago

I got below error while using the example code:

error[E0277]: the trait boundStyleSource: From<&str>` is not satisfied --> src\app.rs:73:17 73 let style = Style::new("background-color: black;").expect("Faile... ^^^^^^^^^^ the trait From<&str> is not implemented for StyleSource

= help: the trait From<Sheet> is implemented for StyleSource = note: required for &str to implement Into<StyleSource> = note: required for StyleSource to implement TryFrom<&str> `

I am using this crate version 0.11.0 with "yew" feature, I saw the code worked well on some other guys' machine. But mine just doesn't work; Could somebody explain to me why this happend?

futursolo commented 1 year ago

This is a breaking change happened in v0.11. The runtime parser is disabled by default after v0.11. To use plain string, you can enable the parser feature.

See: https://docs.rs/stylist/latest/stylist/struct.StyleSource.html#impl-TryFrom%3C%26%27a%20str%3E-for-StyleSource

superuserme commented 1 year ago

Thanks