Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Move away from HashMap use #1

@hammerandtongs

Description

@hammerandtongs

Not the RustPolice but the thing I see is that the apt_repos.rs Package::fields should be statically defined in a struct with some of them being an Option if needed.

This is the most "unrusty" thing about your code. Using a HashMap like this is whats called "stringly typed" code. It's ignoring the power of the type system to clearly define the state of the data expected to keep the error boundary right at ingestion.

Enforce your error boundary as you ingest data from outside and then inside code can rely on clearly Type facts about the data ingested.

I think if you change that idea in apt_repo.rs the rest of your code will clean up from there.

Try using match against values in the struct further into your code for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions