rust_struct_iterable
rust_struct_iterable copied to clipboard
struct_iterable doesn't work if struct contains lifetimes
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
Hi Arif! Thank you so much, I'll check the issue, sorry for the late.