Skip to content

Commit

Permalink
bed/io/writer/record: Add other field writer
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Jul 1, 2024
1 parent 6a8ca5d commit c3bb814
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
5 changes: 4 additions & 1 deletion noodles-bed/src/io/writer/record.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
mod feature_end;
mod feature_start;
mod other_fields;
mod reference_sequence_name;

use std::io::{self, Write};

use self::{
feature_end::write_feature_end, feature_start::write_feature_start,
reference_sequence_name::write_reference_sequence_name,
other_fields::write_other_fields, reference_sequence_name::write_reference_sequence_name,
};
use crate::Record;

Expand All @@ -25,6 +26,8 @@ where
let feature_end = record.feature_end()?;
write_feature_end(writer, feature_end)?;

write_other_fields(writer, record.other_fields())?;

write_newline(writer)?;

Ok(())
Expand Down
16 changes: 16 additions & 0 deletions noodles-bed/src/io/writer/record/other_fields.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use std::io::{self, Write};

use super::write_separator;
use crate::record::OtherFields;

pub(super) fn write_other_fields<W>(writer: &mut W, other_fields: OtherFields<'_>) -> io::Result<()>
where
W: Write,
{
for field in other_fields.iter() {
write_separator(writer)?;
writer.write_all(field)?;
}

Ok(())
}

0 comments on commit c3bb814

Please sign in to comment.