Skip to content

Commit

Permalink
bgzf/async/writer/builder: Rename Builder::build_with_reader to Build…
Browse files Browse the repository at this point in the history
…er::build_from_reader
  • Loading branch information
zaeleus committed Aug 27, 2024
1 parent be1bcfc commit d921ef0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions noodles-bgzf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion noodles-bgzf/src/async/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 12 additions & 3 deletions noodles-bgzf/src/async/reader/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ impl Builder {
self
}

/// Builds an async BGZF reader with an async reader.
/// Builds an async BGZF reader from an async reader.
///
/// # Examples
///
/// ```
/// # 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<R>(self, reader: R) -> Reader<R>
pub fn build_from_reader<R>(self, reader: R) -> Reader<R>
where
R: AsyncRead,
{
Expand All @@ -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<R>(self, reader: R) -> Reader<R>
where
R: AsyncRead,
{
self.build_from_reader(reader)
}
}

0 comments on commit d921ef0

Please sign in to comment.