Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Read in commodities as `Rc<Commodity>`s directly

Open
#605 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
backend

Research direction

Start by locating the code that reads commodities and the conversion from IndexMap<CommodityID, Commodity> to CommodityMap. Check whether Rc::make_mut supports the required field assignments, then update the loading path so commodities are read directly as Rcs and verify the existing project checks.

Written by the indexing model from the issue text.

Description

Annoyingly, when we initially read in the commodities they're stored in an IndexMap<CommodityID, Commodity> then we turn it into an IndexMap<CommodityID, Rc<Commodity>> (i.e. a CommodityMap), otherwise I would have just used a CommodityMap.

I think I did this because I was under the impression that you couldn't really modify Rc things easily (and we need to do that to assign various fields to the commodities), but it looks like there is this function that does what we need: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.make_mut

Originally posted by @alexdewar in https://github.com/EnergySystemsModellingLab/MUSE_2.0/pull/599#discussion_r2128775599

Dominant language
Rust
Stars
8
Forks
5
Avg merge
11h 31m
Merged PRs (30d)
33

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.

More from EnergySystemsModellingLab/MUSE2

All issues in EnergySystemsModellingLab/MUSE2

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.