Skip to content

Expanding mut key API #334

@epage

Description

@epage

toml_edit presents Table as a mapping between Key and Value with KeyMut for providing access to the subset of key functionality that the user can modify. Internally, this is stored as IndexMap<String, (Key, Value)>, where Key contains a String, among other data.

Key.get().clone() to get the String key is showing up in my benchmarks in parsing a real-world Cargo.toml file. I'm exploring my options for avoiding that

I hadn't noticed MutableKeys before and it seems like a good start by allowing me to instead do IndexMap<Key, Value>. Some parts I'm missing for maintaining my KeyMut access for users:

  • MutableKeys::iter_full_mut2
  • MutableOccupiedEntrykeys::get_full_mut2

There may be more as I've not fully gone through my compilation errors. I'm more wondering if this direction is viable before I continue down this path.

I'd be willing to contribute these if there is interest.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions