Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make List::new accept IntoIterator #670

Closed
Valentin271 opened this issue Dec 6, 2023 · 0 comments · Fixed by #672
Closed

Make List::new accept IntoIterator #670

Valentin271 opened this issue Dec 6, 2023 · 0 comments · Fixed by #672
Assignees
Labels
Effort: Good First Issue Good for newcomers without much Rust or Ratatui experiance. Apply only if willing to help implement Type: Breaking Change This change will cause application code to break and must be noted in the breaking changes docs etc. Type: Enhancement New feature or request
Milestone

Comments

@Valentin271
Copy link
Member

Problem

Currently we have to write something like this to create a list.

List::new([ListItem::new("Item 1"), ListItem::new("Item 2"), ListItem::new("Item 3")]);

Would be nice and natural to be able to write

List::new(["Item 1", "Item 2", "Item 3"]);

Solution

Make List::new accept IntoIterator<Item = Into<ListItem>>.

Unfortunately this seems to be breaking bug, especially for empty lists as the compiler cannot infer ::Item's type

Alternatives

Leave as is

Additional context

This should probably be worked on after #669 is merged.

@Valentin271 Valentin271 added Type: Enhancement New feature or request Effort: Good First Issue Good for newcomers without much Rust or Ratatui experiance. Apply only if willing to help implement Type: Breaking Change This change will cause application code to break and must be noted in the breaking changes docs etc. labels Dec 6, 2023
@Valentin271 Valentin271 added this to the v0.26.0 milestone Dec 7, 2023
@Valentin271 Valentin271 self-assigned this Dec 7, 2023
@Valentin271 Valentin271 modified the milestones: v0.26.0, v0.25.0 Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort: Good First Issue Good for newcomers without much Rust or Ratatui experiance. Apply only if willing to help implement Type: Breaking Change This change will cause application code to break and must be noted in the breaking changes docs etc. Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant