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

Refactor Main function #11

Merged
merged 8 commits into from
Jun 25, 2024
Merged

Refactor Main function #11

merged 8 commits into from
Jun 25, 2024

Conversation

LivacoNew
Copy link
Owner

On today's episode of "Sam's undiagnosed ADHD plays up", I've reworked the Main function as it was getting a bit mixed up and messy in there.
It's now been split up into 3 stages;

  • Parse; parse the config + args, as well as some basic pre-processing of the ASCII stuff
  • Detection; go through all the modules the user wants and detect em, placing the output strings into a vec
  • Display; output it alongside the ASCII

This seperates the detection from the output, allowing me much more freedom to preprocess and mess with the output. Also means I don't have to do any weird pre-processing with Mounts and Displays, as they could take up multiple lines.

I've also created a ModuleOutputs struct/variable, placing any values in there instead. That way if a module needs shared data from another, or if some pre-processing happens it only needs to fetch it once.

Finally I've also used this as an excuse to improve the look of suppressed errors, simply making them read "Unknown" as not to ruin the aesthetics of the output.
image

Performance actually sits a few nanoseconds better than before, not one of my goals with this (I was actually expecting worse) but it's nice to see.

@LivacoNew LivacoNew merged commit f1f4e1c into master Jun 25, 2024
@LivacoNew LivacoNew deleted the main-refactor branch July 2, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant