Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Cannot iterate over slice #6

@dtolnay

Description

@dtolnay

Would it be possible to make this work?

#[derive(Template)]
#[template(path = "test")]
struct Test<'a> {
    names: &'a [&'a str],
}
{% for n in names %}
  name = {{ n }}
{% endfor %}
error[E0277]: the trait bound `&&[&str]: std::iter::Iterator` is not satisfied
 --> src/main.rs:7:10
  |
7 | #[derive(Template)]
  |          ^^^^^^^^ the trait `std::iter::Iterator` is not implemented for `&&[&str]`
  |
  = note: `&&[&str]` is not an iterator; maybe try calling `.iter()` or a similar method
  = note: required by `std::iter::IntoIterator::into_iter`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions