From 65d2551687bce1852d2a799ca297d4e6a1886924 Mon Sep 17 00:00:00 2001 From: Andreas Fuchs Date: Sun, 26 Dec 2021 11:13:03 +0100 Subject: [PATCH] Derive PartialEq for StreamInfo and SeekPoint These structures can be compared for equality, and having them be PartialEq means we can easily write tests for them. --- src/metadata.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/metadata.rs b/src/metadata.rs index 708a36e..c846993 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -20,7 +20,7 @@ struct MetadataBlockHeader { } /// The streaminfo metadata block, with important information about the stream. -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, PartialEq)] pub struct StreamInfo { // TODO: "size" would better be called "duration" for clarity. /// The minimum block size (in inter-channel samples) used in the stream. @@ -54,7 +54,7 @@ pub struct StreamInfo { } /// A seek point in the seek table. -#[derive(Clone, Copy)] +#[derive(Clone, Copy, PartialEq)] pub struct SeekPoint { /// Sample number of the first sample in the target frame, or 264 - 1 for a placeholder. pub sample: u64,