Skip to content

Commit

Permalink
cram/async: Move writer to io module
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Apr 15, 2024
1 parent f77d080 commit c6f7756
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion noodles-cram/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Changed

* cram/async: Move reader (`Reader`) to `io` module.
* cram/async: Move reader (`Reader`) and writer (`Writer`) to `io` module.

### Changed

Expand Down
2 changes: 1 addition & 1 deletion noodles-cram/examples/cram_write_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let header = build_header(&reference_sequences)?;

let repository = fasta::Repository::new(reference_sequences);
let mut writer = cram::r#async::writer::Builder::default()
let mut writer = cram::r#async::io::writer::Builder::default()
.set_reference_sequence_repository(repository)
.build_with_writer(io::stdout());

Expand Down
3 changes: 0 additions & 3 deletions noodles-cram/src/async.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//! Async CRAM.

pub mod io;
pub mod writer;

pub use self::writer::Writer;
3 changes: 2 additions & 1 deletion noodles-cram/src/async/io.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Async CRAM I/O.

mod reader;
pub mod writer;

pub use self::reader::Reader;
pub use self::{reader::Reader, writer::Writer};
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ where
/// ```
/// use noodles_cram as cram;
/// use tokio::io;
/// let writer = cram::AsyncWriter::new(io::sink());
/// let writer = cram::r#async::io::Writer::new(io::sink());
/// ```
pub fn new(inner: W) -> Self {
Builder::default().build_with_writer(inner)
Expand All @@ -52,7 +52,7 @@ where
/// ```
/// use noodles_cram as cram;
/// use tokio::io;
/// let writer = cram::AsyncWriter::new(io::sink());
/// let writer = cram::r#async::io::Writer::new(io::sink());
/// let inner = writer.get_ref();
/// ```
pub fn get_ref(&self) -> &W {
Expand All @@ -70,7 +70,7 @@ where
/// use noodles_cram as cram;
/// use noodles_sam as sam;
/// use tokio::io;
/// let mut writer = cram::AsyncWriter::new(io::sink());
/// let mut writer = cram::r#async::io::Writer::new(io::sink());
/// let header = sam::Header::default();
/// writer.shutdown(&header).await?;
/// # Ok(())
Expand All @@ -93,7 +93,7 @@ where
/// # async fn main() -> std::io::Result<()> {
/// use noodles_cram as cram;
///
/// let mut writer = cram::AsyncWriter::new(Vec::new());
/// let mut writer = cram::r#async::io::Writer::new(Vec::new());
/// writer.write_file_definition().await?;
///
/// assert_eq!(writer.get_ref(), &[
Expand Down Expand Up @@ -129,7 +129,7 @@ where
/// use noodles_sam as sam;
/// use tokio::io;
///
/// let mut writer = cram::AsyncWriter::new(io::sink());
/// let mut writer = cram::r#async::io::Writer::new(io::sink());
/// writer.write_file_definition().await?;
///
/// let header = sam::Header::default();
Expand Down Expand Up @@ -165,7 +165,7 @@ where
/// use noodles_sam as sam;
/// use tokio::io;
///
/// let mut writer = cram::AsyncWriter::new(io::sink());
/// let mut writer = cram::r#async::io::Writer::new(io::sink());
/// writer.write_file_definition().await?;
///
/// let header = sam::Header::default();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Builder {
/// ```
/// use noodles_cram as cram;
/// use tokio::io;
/// let writer = cram::r#async::writer::Builder::default().build_with_writer(io::sink());
/// let writer = cram::r#async::io::writer::Builder::default().build_with_writer(io::sink());
/// ```
pub fn build_with_writer<W>(mut self, writer: W) -> Writer<W>
where
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion noodles-cram/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ pub use self::{
};

#[cfg(feature = "async")]
pub use self::r#async::{io::Reader as AsyncReader, Writer as AsyncWriter};
pub use self::r#async::io::{Reader as AsyncReader, Writer as AsyncWriter};

static MAGIC_NUMBER: &[u8] = b"CRAM";

0 comments on commit c6f7756

Please sign in to comment.