[][src]Trait spectrusty_formats::tap::TapChunkRead

pub trait TapChunkRead {
    pub fn chunk_no(&self) -> u32;
pub fn chunk_limit(&self) -> u16;
pub fn rewind(&mut self);
pub fn next_chunk(&mut self) -> Result<Option<u16>>; pub fn skip_chunks(&mut self, skip: u32) -> Result<Option<u16>> { ... }
pub fn rewind_nth_chunk(&mut self, chunk_no: u32) -> Result<bool> { ... }
pub fn forward_chunk(&mut self) -> Result<bool> { ... }
pub fn rewind_prev_chunk(&mut self) -> Result<u32> { ... }
pub fn rewind_chunk(&mut self) -> Result<u32> { ... } }

A trait with tools implemented by tap chunk readers.

Required methods

pub fn chunk_no(&self) -> u32[src]

Returns this chunk's number.

The first chunk's number is 1. If this method returns 0 the cursor is at the beginning of a file, before the first chunk.

pub fn chunk_limit(&self) -> u16[src]

Returns this chunk's remaining bytes to be read.

pub fn rewind(&mut self)[src]

Repositions the inner reader to the start of a file and sets the inner limit to 0. To read the first chunk you need to call TapChunkRead::next_chunk first.

pub fn next_chunk(&mut self) -> Result<Option<u16>>[src]

Forwards the inner reader to the position of the next TAP chunk.

Returns Ok(None) if the end of the file has been reached.

On success returns Ok(size) in bytes of the next TAP chunk and limits the inner Take reader to that size.

Loading content...

Provided methods

pub fn skip_chunks(&mut self, skip: u32) -> Result<Option<u16>>[src]

Forwards the inner reader to the position of a next skip + 1 TAP chunks. Returns Ok(None) if the end of the file has been reached. On success returns Ok(size) in bytes of the next TAP chunk and limits the inner Take reader to that size.

skip_chunks(0) acts the same as TapChunkRead::next_chunk.

pub fn rewind_nth_chunk(&mut self, chunk_no: u32) -> Result<bool>[src]

Rewinds or forwards the tape to the nth chunk. Returns Ok(true) if the nth chunk exists. Otherwise returns Ok(false) and leaves the seek position at the end of the tape.

pub fn forward_chunk(&mut self) -> Result<bool>[src]

Forwards the tape to the next chunk. Returns Ok(true) if the forwarded to chunk exists. Otherwise returns Ok(false) and leaves the seek position at the end of the tape.

pub fn rewind_prev_chunk(&mut self) -> Result<u32>[src]

Rewinds the tape to the beginning of the previous chunk. Returns Ok(chunk_no).

pub fn rewind_chunk(&mut self) -> Result<u32>[src]

Rewinds the tape to the beginning of the current chunk. Returns Ok(chunk_no).

Loading content...

Implementors

impl<R: Read + Seek> TapChunkRead for TapChunkPulseIter<R>[src]

pub fn rewind(&mut self)[src]

Invokes underlying TapChunkReader::rewind and resets the internal pulse iterator. Returns the result from TapChunkReader::rewind.

pub fn next_chunk(&mut self) -> Result<Option<u16>>[src]

Invokes underlying TapChunkReader::next_chunk and resets the internal pulse iterator. Returns the result from TapChunkReader::next_chunk.

pub fn skip_chunks(&mut self, skip: u32) -> Result<Option<u16>>[src]

Invokes underlying TapChunkReader::skip_chunks and resets the internal pulse iterator. Returns the result from TapChunkReader::skip_chunks.

impl<R: Read + Seek> TapChunkRead for TapChunkReader<R>[src]

pub fn next_chunk(&mut self) -> Result<Option<u16>>[src]

Loading content...