From d921ef0e0a3b7c6aedc5c26f92d57df1a57b70bc Mon Sep 17 00:00:00 2001 From: Michael Macias Date: Tue, 27 Aug 2024 08:02:22 -0500 Subject: [PATCH] bgzf/async/writer/builder: Rename Builder::build_with_reader to Builder::build_from_reader --- noodles-bgzf/CHANGELOG.md | 7 +++++++ noodles-bgzf/src/async/reader.rs | 2 +- noodles-bgzf/src/async/reader/builder.rs | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/noodles-bgzf/CHANGELOG.md b/noodles-bgzf/CHANGELOG.md index 36e578604..39d619bf6 100644 --- a/noodles-bgzf/CHANGELOG.md +++ b/noodles-bgzf/CHANGELOG.md @@ -4,11 +4,18 @@ ### Changed + * bgzf/reader/builder: Rename `Builder::build_with_reader` to + `Builder::build_from_reader`. + * bgzf/writer/builder: Rename `Builder::build_with_writer` to `Builder::build_from_writer`. ### Deprecated + * bgzf/async/reader/builder: Deprecate `Builder::build_with_reader`. + + Use `Builder::build_from_reader` instead. + * bgzf/writer/builder: Deprecate `Builder::build_with_writer`. Use `Builder::build_from_writer` instead. diff --git a/noodles-bgzf/src/async/reader.rs b/noodles-bgzf/src/async/reader.rs index b8ff603c5..07fcfa3aa 100644 --- a/noodles-bgzf/src/async/reader.rs +++ b/noodles-bgzf/src/async/reader.rs @@ -47,7 +47,7 @@ where /// let reader = bgzf::AsyncReader::new(&data[..]); /// ``` pub fn new(inner: R) -> Self { - Builder::default().build_with_reader(inner) + Builder::default().build_from_reader(inner) } /// Returns a reference to the underlying reader. diff --git a/noodles-bgzf/src/async/reader/builder.rs b/noodles-bgzf/src/async/reader/builder.rs index b10b06aea..8f8ea1e7a 100644 --- a/noodles-bgzf/src/async/reader/builder.rs +++ b/noodles-bgzf/src/async/reader/builder.rs @@ -30,7 +30,7 @@ impl Builder { self } - /// Builds an async BGZF reader with an async reader. + /// Builds an async BGZF reader from an async reader. /// /// # Examples /// @@ -38,9 +38,9 @@ impl Builder { /// # use tokio::io; /// use noodles_bgzf as bgzf; /// let reader = bgzf::r#async::reader::Builder::default() - /// .build_with_reader(io::empty()); + /// .build_from_reader(io::empty()); /// ``` - pub fn build_with_reader(self, reader: R) -> Reader + pub fn build_from_reader(self, reader: R) -> Reader where R: AsyncRead, { @@ -55,4 +55,13 @@ impl Builder { worker_count, } } + + /// Builds an async BGZF reader from an async reader. + #[deprecated(since = "0.33.0", note = "Use `Builder::build_from_reader` instead.")] + pub fn build_with_reader(self, reader: R) -> Reader + where + R: AsyncRead, + { + self.build_from_reader(reader) + } }