Skip to content

struct_iterable doesn't work if struct contains lifetimes #1

Description

@arifd

Hi! Perfect little crate! But unfortunately this won't work:

use struct_iterable::Iterable;

#[derive(Iterable)]
struct Foo<'a> {
    s: &'a str
}

fn main() {
    let s = "hello";
    let foo = Foo { s };
    for (k, _) in foo.iter() {
        println!("{k}");
    }
}
error[E0726]: implicit elided lifetime not allowed here
 --> src/lib.rs:4:8
  |
4 | struct Foo<'a> {
  |        ^^^ expected lifetime parameter
  |
help: indicate the anonymous lifetime
  |
4 | struct Foo<'_><'a> {
  |           ++++

For more information about this error, try `rustc --explain E0726`.
error: could not compile `arif` (lib) due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions