diff options
author | Teddy Wing | 2018-11-09 20:43:41 +0100 |
---|---|---|
committer | Teddy Wing | 2018-11-09 20:43:41 +0100 |
commit | 1c3e4bc7817b6b802e02cbf6c97e95752b2d9f45 (patch) | |
tree | afc488ca9c8a3b1229cc2d978bdd2eec4c92b6a4 | |
parent | 23e1b2ff654287a74aff8f8cb0246c1310e3151b (diff) | |
download | dome-key-web-1c3e4bc7817b6b802e02cbf6c97e95752b2d9f45.tar.bz2 |
Purchaser::new(): Generate a secret in this method
Realised that when we want a new purchaser, we always want to generate a
secret. This way we can call `new()` without having to call
`generate_secret()` at the call site.
-rw-r--r-- | license-generator/src/purchaser.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/license-generator/src/purchaser.rs b/license-generator/src/purchaser.rs index 3e9656e..445a1dc 100644 --- a/license-generator/src/purchaser.rs +++ b/license-generator/src/purchaser.rs @@ -12,11 +12,15 @@ struct Purchaser<'a> { impl<'a> Purchaser<'a> { fn new(name: &'a str, email: &'a str) -> Self { - Purchaser { + let mut purchaser = Purchaser { name: name, email: email, secret: None, - } + }; + + purchaser.generate_secret(); + + purchaser } fn generate_secret(&mut self) { |