Struct bam::bgzip::read::SeekReader[][src]

pub struct SeekReader<R: Read + Seek> { /* fields omitted */ }
Expand description

A bgzip reader, that allows to jump between blocks.

You can open the reader using from_path or from_stream. Additional threads are used to decompress blocks, while the main thread reads the blocks from a file/stream. If additional_threads is 0, the main thread will decompress blocks itself.

When this reader is opened, it does read not anything, until you specify reading regions. You can do that by using Seek trait, but it is recommended to use methods set_chunks, make_consecutive and from_offset. Note, that in multi-threaded SeekReader it is important to correctly set future reading queue (use set_chunks instead of running from_offset multiple times).

You can read the contents using io::Read, or read blocks using ReadBgzip trait.

Implementations

Opens a reader from a file.

Opens a reader from a stream.

Sets the current chunks. Each chunk specifies a region of the bgzip file. The multi-thread reader reads and decompresses blocks from the chunks in advance (but does not immediately read all blocks).

This function resets the current reading queue (from the previous set_chunks or make_consecutive calls).

chunks must be sorted and should not intersect each other.

Sets the reader in a consecutive mode starting with offset 0, and continuing until the end of the stream.

This function resets the current reading queue.

Sets the reader in a consecutive mode starting with offset, and continuing until the end of the stream.

This function resets the current reading queue.

Consumes the reader and returns inner stream.

Returns current virtual offset.

If the reader has not started, returns the start of the first chunk. If the reader finished the current queue, returns the end of the last chunk.

Trait Implementations

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Like read, except that it reads into a slice of buffers. Read more

🔬 This is a nightly-only experimental API. (can_vector)

Determines if this Reader has an efficient read_vectored implementation. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, appending them to buf. Read more

Read the exact number of bytes required to fill buf. Read more

🔬 This is a nightly-only experimental API. (read_buf)

Pull some bytes from this source into the specified buffer. Read more

🔬 This is a nightly-only experimental API. (read_buf)

Read the exact number of bytes required to fill buf. Read more

Creates a “by reference” adaptor for this instance of Read. Read more

Transforms this Read instance to an Iterator over its bytes. Read more

Creates an adapter which will chain this stream with another. Read more

Creates an adapter which will read at most limit bytes from it. Read more

Reads the next block in a queue. Note, that if the chunks vector contain the same block twice, it will be read only once.

Returns the current block, if possible. This function does not advance the stream.

Pauses multi-thread reader and does nothing for single-thread reader. Read more

Seek to a block with a given block offset, and return new block offset.

This function is not implemented for SeekFrom::End because it will increase running time and is rarely needed.

If the offset is positive, but incorrect (out of bounds or does not point to a start of a block), this function will return Ok, but consecutive read run will return an error.

Note: consider running functions from_offset, make_consecutive or set_chunks, as they are more explicit. Additionally, set_chunks works faster in a multi-threaded reader.

Rewind to the beginning of a stream. Read more

🔬 This is a nightly-only experimental API. (seek_stream_len)

Returns the length of this stream (in bytes). Read more

Returns the current seek position from the start of the stream. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Reads an unsigned 8 bit integer from the underlying reader. Read more

Reads a signed 8 bit integer from the underlying reader. Read more

Reads an unsigned 16 bit integer from the underlying reader. Read more

Reads a signed 16 bit integer from the underlying reader. Read more

Reads an unsigned 24 bit integer from the underlying reader. Read more

Reads a signed 24 bit integer from the underlying reader. Read more

Reads an unsigned 32 bit integer from the underlying reader. Read more

Reads a signed 32 bit integer from the underlying reader. Read more

Reads an unsigned 48 bit integer from the underlying reader. Read more

Reads a signed 48 bit integer from the underlying reader. Read more

Reads an unsigned 64 bit integer from the underlying reader. Read more

Reads a signed 64 bit integer from the underlying reader. Read more

Reads an unsigned 128 bit integer from the underlying reader. Read more

Reads a signed 128 bit integer from the underlying reader. Read more

Reads an unsigned n-bytes integer from the underlying reader. Read more

Reads a signed n-bytes integer from the underlying reader. Read more

Reads an unsigned n-bytes integer from the underlying reader.

Reads a signed n-bytes integer from the underlying reader.

Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader. Read more

Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader. Read more

Reads a sequence of unsigned 16 bit integers from the underlying reader. Read more

Reads a sequence of unsigned 32 bit integers from the underlying reader. Read more

Reads a sequence of unsigned 64 bit integers from the underlying reader. Read more

Reads a sequence of unsigned 128 bit integers from the underlying reader. Read more

Reads a sequence of signed 8 bit integers from the underlying reader. Read more

Reads a sequence of signed 16 bit integers from the underlying reader. Read more

Reads a sequence of signed 32 bit integers from the underlying reader. Read more

Reads a sequence of signed 64 bit integers from the underlying reader. Read more

Reads a sequence of signed 128 bit integers from the underlying reader. Read more

Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader. Read more

👎 Deprecated since 1.2.0:

please use read_f32_into instead

DEPRECATED. Read more

Reads a sequence of IEEE754 double-precision (8 bytes) floating point numbers from the underlying reader. Read more

👎 Deprecated since 1.2.0:

please use read_f64_into instead

DEPRECATED. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.