Iterators and Variables

let iter = (0..1).map(|a| NewsCardData {
    title: format!("Arunjot{}", a),
    desc: format!("desc{}", a),
    url: format!("https://example.com/{}", a),
    atr: format!("Atr-592{}", a),
});

How to make a single iter. I want a make a single variable without any loop

How do you need to use this "single iter"? std::iter::once() might be what you're looking for.

1 Like

yes ..thank you so much

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.