Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve the existing solution with multiple HashMap structs #14

Open
etolbakov opened this issue Jun 12, 2023 · 1 comment
Open

improve the existing solution with multiple HashMap structs #14

etolbakov opened this issue Jun 12, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@etolbakov
Copy link
Owner

etolbakov commented Jun 12, 2023

It feels that these number of structs is excessive:

excalidocker-rs/src/main.rs

Lines 143 to 147 in 99459d0

let mut components = Vec::new();
let mut container_name_rectangle_structs = HashMap::new();
let mut container_name_to_point = HashMap::new();
let mut container_name_to_parents: HashMap<&str, DependencyComponent> = HashMap::new();
let mut container_name_to_container_struct = HashMap::new();

During the development I came up with the most straightforward solution and didn't have much time to reflect on the optimal one, but maybe we can reduce the number of HashMap structs.

@etolbakov etolbakov added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 12, 2023
@etolbakov
Copy link
Owner Author

As per suggestion I received

To address this issue, I suggest refactoring the code to use a single HashMap with a custom struct to store the different types of data associated with container names. This approach would help simplify the codebase and reduce redundancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant