-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: add import-export functions for regions #9
base: master
Are you sure you want to change the base?
feat: add import-export functions for regions #9
Conversation
/.vscode | ||
er-save-editor.exe | ||
fixtures/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignores test files
src/main.rs
Outdated
@@ -94,6 +97,25 @@ impl App { | |||
} | |||
} | |||
|
|||
fn save_regions(&mut self, path: PathBuf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this using anything in main or can it be moved to the regions vm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the view model specific functionality into that scope. Keeping the rest here as it deals with writing.
src/vm/regions.rs
Outdated
|
||
if is_invadeable_region { | ||
let region = ID_TO_REGION.lock().unwrap()[key]; | ||
regions_vm.regions.get_mut(®ion).expect("").0 = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can use unwrap()
instead of expect("")
if no error message is needed.
Aslo maybe split it into two lines to give the .0
a self descriptive name
let (activated, _,_,_) = regions_vm.regions.get_mut(®ion).unwrap();
*activated = true;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I should reserve this refactor until later, so we can focus on functionality in this PR.
@ClayAmore I discovered a bug in my original implementation where I wasn't correctly using the provided enabled_ids when they are present. I corrected this and DRYed things up here: |
No description provided.