Просмотр исходного кода

Derive "Debug" for all data structs.

Jing Yang 3 лет назад
Родитель
Сommit
b5c4b8d8f8
2 измененных файлов с 4 добавлено и 2 удалено
  1. 1 1
      src/beat_ticker.rs
  2. 3 1
      src/verify_authority.rs

+ 1 - 1
src/beat_ticker.rs

@@ -5,7 +5,7 @@ use std::sync::Arc;
 
 /// A beat is one request sent to a peer with a success response.
 /// The `usize` within is the unique ID of the request.
-#[derive(Eq, Ord, PartialOrd, PartialEq)]
+#[derive(Debug, Eq, Ord, PartialOrd, PartialEq)]
 pub(crate) struct Beat(usize);
 
 /// A `BeatTicker` issues unique request IDs and records successful runs.

+ 3 - 1
src/verify_authority.rs

@@ -12,6 +12,7 @@ use std::time::{Duration, Instant};
 /// The result returned to a verify authority request.
 /// This request is not directly exposed to end users. Instead it is used
 /// internally to implement no-commit read-only requests.
+#[derive(Debug)]
 pub enum VerifyAuthorityResult {
     Success(Index),
     TermElapsed,
@@ -20,6 +21,7 @@ pub enum VerifyAuthorityResult {
 
 /// Token stored in the internal queue for authority verification. Each token
 /// represents one verification request.
+#[derive(Debug)]
 struct VerifyAuthorityToken {
     commit_index: Index,
     beats_moment: Vec<Beat>,
@@ -27,7 +29,7 @@ struct VerifyAuthorityToken {
     sender: tokio::sync::oneshot::Sender<VerifyAuthorityResult>,
 }
 
-#[derive(Clone, Copy, Default, Eq, Ord, PartialOrd, PartialEq)]
+#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialOrd, PartialEq)]
 struct QueueIndex(usize);
 
 /// The state of this daemon, should bee protected by a mutex.