rust-cli / rust-cli/config-rs

impl Source for IntoIterator and slices instead of Vec

Open
#53 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
Dominant language
Rust
Stars
3.2k
Forks
265
Avg merge
2h 42m
Merged PRs (30d)
4

Description

I find the impl Source for Vec in the current version of the library ugly. It requires the list of config sources to always be a Vec, which is ugly and constraining.

I think it would be a much better idea to instead impl Source for slices and for IntoIterator.

impling it for slices would allow using static arrays as well as Vecs.

impling it for IntoIterator would make it possible to use the merge method on any Iterator of sources, without collecting into a Vec. This makes things more elegant and removes unnecessary performance overhead when working with things like glob (such as the glob example in the repo).

I think this change would make the API more elegant and would be desirable for version 1.0.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing impl Source for Vec and the merge API, then inspect the repository's glob example. Define the trait implementations for slices and IntoIterator so callers can use arrays, Vecs, and iterators without collecting first; done when those usage patterns compile and the relevant examples or tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.