[][src]Enum spectrusty_utils::tap::Tap

pub enum Tap<F> {
    Reader(TapChunkPulseIter<F>),
    Writer(TapChunkWriter<F>),
}

An enum with two variants, one for reading and the other for writing to the same TAP file.

The F can be anything that implements: Read + Write + Seek.

Variants

Reader(TapChunkPulseIter<F>)
Writer(TapChunkWriter<F>)

Implementations

impl<F: Write + Read + Seek> Tap<F>[src]

pub fn new_reader(file: F) -> Self[src]

Returns a Tap::Reader variant.

pub fn try_new_writer(file: F) -> Result<Self>[src]

Returns a Tap::Writer variant on success.

pub fn reader_mut(&mut self) -> Option<&mut TapChunkPulseIter<F>>[src]

Returns a mutable reference to the pulse iterator if the current variant of self is Tap::Reader.

pub fn writer_mut(&mut self) -> Option<&mut TapChunkWriter<F>>[src]

Returns a mutable reference to the tap chunk writer if the current variant of self is Tap::Writer.

pub fn reader_ref(&self) -> Option<&TapChunkPulseIter<F>>[src]

Returns a reference to the pulse iterator if the current variant of self is Tap::Reader.

pub fn writer_ref(&self) -> Option<&TapChunkWriter<F>>[src]

Returns a reference to the tap chunk writer if the current variant of self is Tap::Writer.

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

Returns true if self is a Tap::Reader.

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

Returns true if self is a Tap::Writer.

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

Transforms the provided Tap into the Tap::Reader on success.

The cursor position of the reader is set to the beginning of a file.

If self is a Tap::Writer this method ensures that the chunk being currently written is comitted thus ensuring the integrity of the TAP file and also calls the Write::flush on the file before transforming it.

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

Transforms the provided Tap into the Tap::Writer on success.

The cursor position of the writer is set to the end of a file.

If self is already a Tap::Writer this method ensures that the chunk being currently written is comitted thus ensuring the integrity of the TAP file and also calls the Write::flush on the file before transforming it.

pub fn try_into_file(self) -> Result<F>[src]

Returns the unwrapped file on success.

If self is a Tap::Writer this method ensures that the chunk being currently written is comitted thus ensuring the integrity of the TAP file and also calls the Write::flush on the file before returning it.

pub fn try_reader_mut(&mut self) -> Result<TapChunkReaderMut<'_, F>>[src]

Returns a clone of [TapChunkReader] with a mutable reference to the file under the guard that ensures the position of the underlying file is set back to where it was before this method was called when the guard goes out of scope.

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

Conditionally rewinds a tape if its variant is Tap::Reader. In this instance returns true. Otherwise returns false.

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

Conditionally forwards a tape to the next chunk if its variant is Tap::Reader. In this instance returns Ok(Some(was_next_chunk)). Otherwise returns Ok(None).

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

Conditionally rewinds a tape to the previous chunk if its variant is Tap::Reader. In this instance returns Ok(Some(chunk_no)). Otherwise returns Ok(None).

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

Conditionally rewinds a tape to the beginning of the current chunk if its variant is Tap::Reader. In this instance returns Ok(Some(chunk_no)). Otherwise returns Ok(None).

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

Conditionally rewinds or forwards a tape to the nth chunk if its variant is Tap::Reader. In this instance returns Ok(Some(was_a_chunk)). Otherwise returns Ok(None).

Trait Implementations

impl<F> Debug for Tap<F>[src]

Auto Trait Implementations

impl<F> !RefUnwindSafe for Tap<F>

impl<F> Send for Tap<F> where
    F: Send

impl<F> Sync for Tap<F> where
    F: Sync

impl<F> Unpin for Tap<F> where
    F: Unpin

impl<F> !UnwindSafe for Tap<F>

Blanket Implementations

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

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

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

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

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>, 

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>,