dioxus-community / dioxus-free-icons

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

`Component<_>` is not implemented for `fn(IconProps<_>) -> Result<VNode, RenderError> {Icon::<_>}` #57

Closed markcda closed 1 week ago

markcda commented 2 weeks ago
00:00:49 [cargo] error[E0277]: `Component<_>` is not implemented for `fn(IconProps<_>) -> Result<VNode, RenderError> {Icon::<_>}`
   --> /home/titoffklim/project/src/components/accordion.rs:94:9
    |
87  | /   rsx! {
88  | |     div {
89  | |       class: "flex",
90  | |       button {
...   |
94  | |         Icon {
    | |         ^^^^ Component
...   |
99  | |     }
100 | |   }
    | |___- required by a bound introduced by this call
    |
    = note: consider using `--verbose` to print the full type name to the console
    = help: the trait `ComponentFunction<_, _>` is not implemented for fn item `fn(IconProps<_>) -> Result<VNode, RenderError> {Icon::<_>}`
    = note: Components are functions in the form `fn() -> Element`, `fn(props: Properties) -> Element`, or `#[component] fn(partial_eq1: u32, partial_eq2: u32) -> Element`.
    = note: You may have forgotten to add `#[component]` to your function to automatically implement the `ComponentFunction` trait.
note: required by a bound in `dioxus::prelude::fc_to_builder`
   --> /home/titoffklim/.cargo/git/checkouts/dioxus-1e619ce595d3799d/e0575b3/packages/core/src/properties.rs:110:36

This error shows up on 0.6.0-alpha.4 version, simple adding #[component] to pub fn Icon<T> isn't working

marc2332 commented 2 weeks ago

This is because dioxus-free-icons's dioxus and your dioxus (alpha.4) don't match. Can you try with https://github.com/dioxus-community/dioxus-free-icons/pull/55 ?

markcda commented 2 weeks ago

Can you try with #55 ?

Yeah, already tried it

dioxus-free-icons = { git = "https://github.com/dioxus-community/dioxus-free-icons.git", branch = "feat/dioxus-0.6", features = ["hero-icons-solid"] }
marc2332 commented 2 weeks ago

Can you try with #55 ?

Yeah, already tried it

dioxus-free-icons = { git = "https://github.com/dioxus-community/dioxus-free-icons.git", branch = "feat/dioxus-0.6", features = ["hero-icons-solid"] }

Try updating with cargo update, I updated it to alpha 4 just some minutes ago

markcda commented 2 weeks ago

Can you try with #55 ?

Yeah, already tried it

dioxus-free-icons = { git = "https://github.com/dioxus-community/dioxus-free-icons.git", branch = "feat/dioxus-0.6", features = ["hero-icons-solid"] }

Try updating with cargo update, I updated it to alpha 4 just some minutes ago

I've seen. This is the dioxus-free-icons/Cargo.toml that I using:

# monorepo only work when using virtual manifest
# see: https://github.com/rust-lang/cargo/issues/7467#issuecomment-867632379
[workspace]
resolver = "2"
members = [
    "packages/codegen",
    "packages/example",
    "packages/lib",
]

[workspace.dependencies]
dioxus = "0.6.0-alpha.4"
marc2332 commented 2 weeks ago

But did you run cargo update?

markcda commented 2 weeks ago

But did you run cargo update?

Yes, of course. I mean, I saw your update and sync in a minute. No changes at all. Tell me if you needed an example project to reproduce the error.

markcda commented 1 week ago

Well, I just created a project from scratch and everything compiled.

I'm so sorry for wasting your time. Thank for your patience!