[][src]Struct spectrusty_formats::tap::TapChunk

pub struct TapChunk<T> { /* fields omitted */ }

The TAP chunk.

Provides helper methods to interpret the underlying bytes as one of the TAP blocks. This should usually be a Header or a data block.

Anything that implements AsRef<[u8]> can be used as T (e.g. &[u8] or Vec<u8>).

Instances of TapChunk can be created using From/Into interface or via TapChunkIter.

Implementations

impl<T> TapChunk<T>[src]

pub fn into_inner(self) -> T[src]

Returns the underlying bytes container.

impl<T> TapChunk<T> where
    T: AsRef<[u8]>, 
[src]

pub fn info(&self) -> Result<TapChunkInfo>[src]

Attempts to create an instance of TapChunkInfo from underlying data.

pub fn checksum(&self) -> u8[src]

Calculates bit-xor checksum of underlying data.

pub fn is_head(&self) -> bool[src]

Checks if this TAP chunk is a Header block.

pub fn is_data(&self) -> bool[src]

Checks if this TAP chunk is a data block.

pub fn is_valid(&self) -> bool[src]

Checks if this TAP chunk is a valid data or Header block.

pub fn validated(self) -> Result<Self>[src]

Validates if this TAP chunk is a valid data or Header block returning self on success.

pub fn validate(&self) -> Result<()>[src]

Validates if this TAP chunk is a valid data or Header block.

pub fn name(&self) -> Option<Cow<'_, str>>[src]

Returns a name if the block is a Header

pub fn data(&self) -> Option<&[u8]>[src]

Returns a reference to the underlying data block only if the underlying bytes represents the data block.

The provided reference does not include block flag and checksum bytes.

pub fn data_block_len(&self) -> Option<u16>[src]

Returns a length in bytes of the next chunk's data block only if the underlying bytes represents the Header block.

The provided length does not include block flag and checksum bytes.

pub fn start(&self) -> Option<u16>[src]

Returns a starting address only if the underlying bytes represents the Header block.

Depending of the type of this header it may be either a starting address of BlockType::Code or starting line of BlockType::Program.

pub fn vars(&self) -> Option<u16>[src]

Returns an offset to VARS only if the underlying bytes represents the Header block.

Only valid for headers with BlockType::Program.

pub fn array_name(&self) -> Option<char>[src]

Returns an array variable name only if the underlying bytes represents the Header block.

Only valid for headers with BlockType::CharArray or BlockType::NumberArray.

pub fn block_type(&self) -> Option<BlockType>[src]

Returns a next chunk's data type only if the underlying bytes represents the Header block.

pub fn as_pulse_iter(&self) -> ReadEncPulseIter<Cursor<&[u8]>>

Notable traits for ReadEncPulseIter<R>

impl<R: Read> Iterator for ReadEncPulseIter<R> type Item = NonZeroU32;
[src]

Returns a pulse interval iterator referencing this TAP chunk.

pub fn into_pulse_iter(self) -> ReadEncPulseIter<Cursor<T>>

Notable traits for ReadEncPulseIter<R>

impl<R: Read> Iterator for ReadEncPulseIter<R> type Item = NonZeroU32;
[src]

Converts this TAP chunk into a pulse interval iterator owning this chunk's data.

pub fn with_storage<D>(self) -> TapChunk<D> where
    D: From<T> + AsRef<[u8]>, 
[src]

Creates a new TapChunk with a specified storage, possibly cloning the data unless the target storage can be converted to without cloning, e.g. Vec<u8> <=> Box<[u8]>.

Trait Implementations

impl<T> AsMut<[u8]> for TapChunk<T> where
    T: AsMut<[u8]>, 
[src]

impl<T> AsRef<[u8]> for TapChunk<T> where
    T: AsRef<[u8]>, 
[src]

impl<T: Clone> Clone for TapChunk<T>[src]

impl<T: Copy> Copy for TapChunk<T>[src]

impl<T: Debug> Debug for TapChunk<T>[src]

impl<T> Display for TapChunk<T> where
    T: AsRef<[u8]>, 
[src]

impl<T> From<T> for TapChunk<T> where
    T: AsRef<[u8]>, 
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for TapChunk<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for TapChunk<T> where
    T: Send
[src]

impl<T> Sync for TapChunk<T> where
    T: Sync
[src]

impl<T> Unpin for TapChunk<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for TapChunk<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<A, T> AsBits<T> for A where
    T: BitStore + BitRegister,
    A: AsRef<[T]>, 

impl<A, T> AsBits<T> for A where
    T: BitStore + BitRegister,
    A: AsRef<[T]>, 

impl<A, T> AsBitsMut<T> for A where
    T: BitStore + BitRegister,
    A: AsMut<[T]>, 

impl<A, T> AsBitsMut<T> for A where
    T: BitStore + BitRegister,
    A: AsMut<[T]>, 

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<S, T> IntoSample<S> for T where
    S: FromSample<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,