diff --git a/noodles-bed/src/io/writer/record.rs b/noodles-bed/src/io/writer/record.rs index 8046a6761..a45fa9f06 100644 --- a/noodles-bed/src/io/writer/record.rs +++ b/noodles-bed/src/io/writer/record.rs @@ -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; @@ -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(()) diff --git a/noodles-bed/src/io/writer/record/other_fields.rs b/noodles-bed/src/io/writer/record/other_fields.rs new file mode 100644 index 000000000..3211cd788 --- /dev/null +++ b/noodles-bed/src/io/writer/record/other_fields.rs @@ -0,0 +1,16 @@ +use std::io::{self, Write}; + +use super::write_separator; +use crate::record::OtherFields; + +pub(super) fn write_other_fields(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(()) +}