Skip to content

Commit

Permalink
vcf/writer/builder: Add Builder::build_from_writer
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Oct 23, 2023
1 parent edee012 commit f312c18
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions noodles-vcf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
Change instantiations of `vcf::reader::Builder` to
`vcf::reader::Builder::default()`.

* vcf/writer/builder: Add `Builder::build_from_writer`.

### Changed

* vcf/reader/builder: Change `Builder::build_from_reader` to accept
Expand Down
16 changes: 16 additions & 0 deletions noodles-vcf/src/writer/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,20 @@ impl Builder {

Ok(Writer::new(writer))
}

/// Builds a VCF writer from a writer.
///
/// # Examples
///
/// ```
/// # use std::io;
/// use noodles_vcf as vcf;
/// let writer = vcf::writer::Builder.build_from_writer(io::sink());
/// ```
pub fn build_from_writer<W>(self, writer: W) -> Writer<W>
where
W: Write,
{
Writer::new(writer)
}
}

0 comments on commit f312c18

Please sign in to comment.