Make the Discovery event into a struct instead of a tuple

This commit is contained in:
Greg Fitzgerald
2018-02-24 11:15:03 -07:00
parent 7d9bab9508
commit b8d52cc3e4
4 changed files with 15 additions and 8 deletions

View File

@ -37,7 +37,8 @@ use std::sync::mpsc::SendError;
fn create_log(hist: &Historian) -> Result<(), SendError<Event>> {
sleep(Duration::from_millis(15));
hist.sender.send(Event::Discovery(Sha256Hash::default()))?;
let data = Sha256Hash::default();
hist.sender.send(Event::Discovery { data })?;
sleep(Duration::from_millis(10));
Ok(())
}
@ -62,7 +63,7 @@ Running the program should produce a log similar to:
```rust
Entry { num_hashes: 0, end_hash: [0, ...], event: Tick }
Entry { num_hashes: 2, end_hash: [67, ...], event: Discovery(3735928559) }
Entry { num_hashes: 2, end_hash: [67, ...], event: Discovery { data: [37, ...] } }
Entry { num_hashes: 3, end_hash: [123, ...], event: Tick }
```