dioxus-community / dioxus-free-icons

Use free svg icons in your Dioxus projects easily with dioxus-free-icons.
Other
73 stars 18 forks source link

the trait bound ... is not satisfied #37

Closed tkr-sh closed 6 months ago

tkr-sh commented 6 months ago

When trying to create a basic icon with this code:

#[component]
pub fn test() -> Element {
    rsx!(
        Icon {
            width: 30,
            height: 30,
            fill: "black",
            icon: IoMailOpen,
        }
    )
}

I get the following error:

error[E0277]: the trait bound `fn(IconProps<_>) -> std::option::Option<dioxus_core::nodes::VNode> {Icon::<_>}: dioxus::prelude::ComponentFunction<_, _>` is not satisfied
  --> src/main.rs:36:9
   |
35 | /     rsx!(
36 | |         Icon {
   | |         ^^^^ the trait `dioxus::prelude::ComponentFunction<_, _>` is not implemented for fn item `fn(IconProps<_>) -> std::option::Option<dioxus_core::nodes::VNode> {Icon::<_>}`
37 | |             width: 30,
38 | |             height: 30,
...  |
41 | |         }
42 | |     )
   | |_____- required by a bound introduced by this call
   |
   = help: the trait `dioxus::prelude::ComponentFunction<Rc<Cell<RouterConfig<Route>>>>` is implemented for `Route`
marc2332 commented 6 months ago

Are you using Dioxus 0.5?

tkr-sh commented 6 months ago

@marc2332 yes!

marc2332 commented 6 months ago

@marc2332 yes!

Can you share me your Cargo.toml?

tkr-sh commented 6 months ago
[package]
...

[dependencies]
dioxus = { git = "https://github.com/DioxusLabs/dioxus", features = ["fullstack", "router"] }
dioxus-free-icons = { version = "0.8.3", features = ["ionicons"] }

[features]
default = []
server = ["dioxus/axum"]
web = ["dioxus/web"]
marc2332 commented 6 months ago
[package]
...

[dependencies]
dioxus = { git = "https://github.com/DioxusLabs/dioxus", features = ["fullstack", "router"] }
dioxus-free-icons = { version = "0.8.3", features = ["ionicons"] }

[features]
default = []
server = ["dioxus/axum"]
web = ["dioxus/web"]

You are not using the 0.5 release of Dioxus, you are using it from git

tkr-sh commented 6 months ago

Oh right! That was it, thank you!

marc2332 commented 6 months ago

No problem!