diff --git a/noodles-fastq/src/record.rs b/noodles-fastq/src/record.rs index 67c1f9251..da8799497 100644 --- a/noodles-fastq/src/record.rs +++ b/noodles-fastq/src/record.rs @@ -4,8 +4,10 @@ mod definition; pub use self::definition::Definition; +use std::fmt; + /// A FASTQ record. -#[derive(Clone, Default, Debug, Eq, PartialEq)] +#[derive(Clone, Default, Eq, PartialEq)] pub struct Record { definition: Definition, sequence: Vec, @@ -165,6 +167,24 @@ impl Record { } } +impl fmt::Debug for Record { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + use std::str; + + let name = str::from_utf8(self.name()); + let description = str::from_utf8(self.description()); + let sequence = str::from_utf8(self.sequence()); + let quality_scores = str::from_utf8(self.quality_scores()); + + f.debug_struct("Record") + .field("name", &name) + .field("description", &description) + .field("sequence", &sequence) + .field("quality_scores", &quality_scores) + .finish() + } +} + #[cfg(test)] mod tests { use super::*;