Skip to content

Commit

Permalink
cram/io/writer/builder: Rename Builder::build_with_path to Builder::b…
Browse files Browse the repository at this point in the history
…uild_from_path

See #295.
  • Loading branch information
zaeleus committed Aug 27, 2024
1 parent e7c1385 commit 8b2cd79
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
13 changes: 13 additions & 0 deletions noodles-cram/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
[#293]: https://github.com/zaeleus/noodles/issues/293
[#294]: https://github.com/zaeleus/noodles/issues/294

### Changed

* cram/io/writer/builder: Rename `Builder::build_with_path` to
`Builder::build_from_path` ([#295]).

[#295]: https://github.com/zaeleus/noodles/issues/295

### Deprecated

* cram/io/writer/builder: Deprecate `Builder::build_with_path`.

Use `Builder::build_from_path` instead.

## 0.67.0 - 2024-08-04

### Added
Expand Down
13 changes: 11 additions & 2 deletions noodles-cram/src/async/io/writer/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ impl Builder {
/// # #[tokio::main]
/// # async fn main() -> tokio::io::Result<()> {
/// use noodles_cram::r#async::io::writer::Builder;
/// let writer = Builder::default().build_with_path("out.cram").await?;
/// let writer = Builder::default().build_from_path("out.cram").await?;
/// # Ok(())
/// # }
/// ```
pub async fn build_with_path<P>(self, dst: P) -> io::Result<Writer<File>>
pub async fn build_from_path<P>(self, dst: P) -> io::Result<Writer<File>>
where
P: AsRef<Path>,
{
Expand All @@ -76,6 +76,15 @@ impl Builder {
.map(|file| self.build_with_writer(file))
}

/// Builds an async CRAM writer from a path.
#[deprecated(since = "0.68.0", note = "Use `Builder::build_from_path` instead.")]
pub async fn build_with_path<P>(self, dst: P) -> io::Result<Writer<File>>
where
P: AsRef<Path>,
{
self.build_from_path(dst).await
}

/// Builds an async CRAM writer from a writer.
///
/// # Examples
Expand Down
13 changes: 11 additions & 2 deletions noodles-cram/src/io/writer/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,25 @@ impl Builder {
///
/// ```no_run
/// use noodles_cram::io::writer::Builder;
/// let writer = Builder::default().build_with_path("out.cram")?;
/// let writer = Builder::default().build_from_path("out.cram")?;
/// # Ok::<_, std::io::Error>(())
/// ```
pub fn build_with_path<P>(self, dst: P) -> io::Result<Writer<File>>
pub fn build_from_path<P>(self, dst: P) -> io::Result<Writer<File>>
where
P: AsRef<Path>,
{
File::create(dst).map(|file| self.build_with_writer(file))
}

/// Builds a CRAM writer from a path.
#[deprecated(since = "0.68.0", note = "Use `Builder::build_from_path` instead.")]
pub fn build_with_path<P>(self, dst: P) -> io::Result<Writer<File>>
where
P: AsRef<Path>,
{
self.build_from_path(dst)
}

/// Builds a CRAM writer from a writer.
///
/// # Examples
Expand Down

0 comments on commit 8b2cd79

Please sign in to comment.