aboutsummaryrefslogtreecommitdiff
path: root/rust/src/implementation/passwordmaker/thread_messages.rs
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2022-10-10 21:30:02 +0200
committerAndreas Grois <andi@grois.info>2022-10-10 21:37:15 +0200
commite4ad766315879e1ff05bb111229f073f8f0ed68e (patch)
tree4b043ff47c78b2c00c80c94ebda622c32c8b6d3d /rust/src/implementation/passwordmaker/thread_messages.rs
PassFish: Initial Commit
Well, that's a lie. But nobody needs to see all the iterations I decided to sweep under the rug. That said, I think the repo is, while not clean, clean enough now, to not be embarrassed by uploading it to github.
Diffstat (limited to 'rust/src/implementation/passwordmaker/thread_messages.rs')
-rw-r--r--rust/src/implementation/passwordmaker/thread_messages.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/rust/src/implementation/passwordmaker/thread_messages.rs b/rust/src/implementation/passwordmaker/thread_messages.rs
new file mode 100644
index 0000000..bba3dfa
--- /dev/null
+++ b/rust/src/implementation/passwordmaker/thread_messages.rs
@@ -0,0 +1,41 @@
+use std::sync::Arc;
+use passwordmaker_rs::{GenerationError,SettingsError};
+use crate::implementation::profiles::GenerationSettings;
+
+pub(super) enum HelperToUi {
+ Generated {
+ password : String,
+ },
+ GenerationFailed {
+ error : GenerationIssue
+ },
+ GenerationStarted
+}
+
+pub(super) struct GeneratePasswordTask{
+ pub(crate) input : String,
+ pub(crate) master_password : String,
+ pub(crate) generation_settings : Arc<GenerationSettings>
+}
+
+pub(super) enum UiToHelper {
+ Shutdown,
+ GeneratePassword(GeneratePasswordTask),
+}
+
+pub(super) enum GenerationIssue {
+ Settings(SettingsError),
+ Input(GenerationError),
+}
+
+impl From<SettingsError> for GenerationIssue {
+ fn from(s: SettingsError) -> Self {
+ GenerationIssue::Settings(s)
+ }
+}
+
+impl From<GenerationError> for GenerationIssue {
+ fn from(g: GenerationError) -> Self {
+ GenerationIssue::Input(g)
+ }
+} \ No newline at end of file