rust-cli / rust-cli/config-rs

Option to overwrite rather than merge HashMaps

Open
#431 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have multiple config sources. For most data types, when a field is available from multiple sources, there's an order of precedence for which one to use. However, one of the fields in my settings struct is a HashMap. I have found that when this field is available from multiple config settings, the HashMaps are merged together, where keys from both sources are present in the deserialized output. I would prefer that one whole HashMap overrides another, to bring the behavior in line with that of the primitive types. Or, at least have an option I can call on the ConfigBuilder to ask for this behavior.

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 ConfigBuilder and tracing how HashMaps from multiple config sources are combined, then inspect the surrounding precedence behavior. Define completion as an available option that makes one whole HashMap override another rather than merging keys, with the resulting deserialized settings matching the selected precedence.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.