Skip to content

Commit

Permalink
implement Debug and PartialEq for TimeSpan.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwen-lg committed May 19, 2024
1 parent c1b4dfd commit 26f67ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/time/time_span.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::TimePoint;
use std::fmt::{self, Debug};

/// Define a time span with a start time and an end time.
#[derive(Clone, Copy)]
#[derive(Clone, Copy, PartialEq)]
pub struct TimeSpan {
/// Start time of the span
pub start: TimePoint,
Expand All @@ -16,3 +17,9 @@ impl TimeSpan {
Self { start, end }
}
}

impl Debug for TimeSpan {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{} --> {}", self.start, self.end)
}
}

0 comments on commit 26f67ca

Please sign in to comment.