Skip to content

Commit

Permalink
fastq/async/io/writer: Reuse default definition separator constant
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Aug 2, 2024
1 parent e6735c5 commit 0c220d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions noodles-fastq/src/async/io/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,16 @@ async fn write_record<W>(writer: &mut W, record: &Record) -> io::Result<()>
where
W: AsyncWrite + Unpin,
{
use crate::io::writer::DEFAULT_DEFINITION_SEPARATOR;

const NAME_PREFIX: &[u8] = b"@";
const DEFINITION_SEPARATOR: &[u8] = b" ";
const LINE_FEED: &[u8] = b"\n";

writer.write_all(NAME_PREFIX).await?;
writer.write_all(record.name()).await?;

if !record.description().is_empty() {
writer.write_all(DEFINITION_SEPARATOR).await?;
writer.write_all(&[DEFAULT_DEFINITION_SEPARATOR]).await?;
writer.write_all(record.description()).await?;
}

Expand Down
2 changes: 1 addition & 1 deletion noodles-fastq/src/io/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub use self::builder::Builder;
use self::record::write_record;
use crate::Record;

const DEFAULT_DEFINITION_SEPARATOR: u8 = b' ';
pub(crate) const DEFAULT_DEFINITION_SEPARATOR: u8 = b' ';

/// A FASTQ writer.
pub struct Writer<W> {
Expand Down

0 comments on commit 0c220d1

Please sign in to comment.