pub struct TapChunkWriter<W> { /* private fields */ }Expand description
A tool for writing TAP file chunks to byte streams.
Data can be written in one of 3 ways:
- Writing tap chunk data at once with TapChunkWriter::write_header or TapChunkWriter::write_chunk.
- Writing tap chunk data with multiple writes via TapChunkWriter::begin and then TapChunkWriteTran.
- Writing tap chunks from decoded TAPE pulse iterators with TapChunkWriter::write_pulses_as_tap_chunks.
Implementations§
Source§impl<W> TapChunkWriter<W>
impl<W> TapChunkWriter<W>
Sourcepub fn into_inner(self) -> PulseDecodeWriter<W>
pub fn into_inner(self) -> PulseDecodeWriter<W>
Returns the underlying pulse decode writer.
Sourcepub fn get_mut(&mut self) -> &mut PulseDecodeWriter<W>
pub fn get_mut(&mut self) -> &mut PulseDecodeWriter<W>
Returns a mutable reference to the inner pulse decode writer.
Sourcepub fn get_ref(&self) -> &PulseDecodeWriter<W>
pub fn get_ref(&self) -> &PulseDecodeWriter<W>
Returns a shared reference to the inner pulse decode writer.
Source§impl<W> TapChunkWriter<W>
impl<W> TapChunkWriter<W>
Sourcepub fn try_new(wr: W) -> Result<Self>
pub fn try_new(wr: W) -> Result<Self>
Returns a new instance of TapChunkWriter with the given writer on success.
The stream cursor should be positioned where the next chunk will be written.
This method does not write any data, but moves the stream cursor to make room for the next block’s length indicator.
Sourcepub fn flush(&mut self) -> Result<()>
pub fn flush(&mut self) -> Result<()>
Flushes the underlying writer, ensuring that all intermediately buffered contents reach their destination (invokes Write::flush).
Sourcepub fn end_pulse_chunk(&mut self) -> Result<usize>
pub fn end_pulse_chunk(&mut self) -> Result<usize>
Forces pending pulse decode data transfer to end.
Returns the number of TAP chunks written.
Sourcepub fn write_header(&mut self, header: &Header) -> Result<usize>
pub fn write_header(&mut self, header: &Header) -> Result<usize>
Writes a provided header as a TAP chunk.
Flushes internal mic pulse writer before proceeding with writing the header.
Returns the number of TAP chunks written.
Sourcepub fn write_chunk<D: AsRef<[u8]>>(&mut self, chunk: D) -> Result<usize>
pub fn write_chunk<D: AsRef<[u8]>>(&mut self, chunk: D) -> Result<usize>
Writes provided data as a TAP chunk.
Flushes internal mic pulse writer before proceeding with writing the data.
Returns the number of TAP chunks written.
Sourcepub fn begin(&mut self) -> Result<TapChunkWriteTran<'_, W>>
pub fn begin(&mut self) -> Result<TapChunkWriteTran<'_, W>>
Creates a transaction allowing for multiple data writes to the same TAP chunk.
Flushes internal mic pulse writer.
Returns a transaction holder, which can be used to write data to the current chunk.
Sourcepub fn write_pulses_as_tap_chunks<I>(&mut self, iter: I) -> Result<usize>where
I: Iterator<Item = NonZeroU32>,
pub fn write_pulses_as_tap_chunks<I>(&mut self, iter: I) -> Result<usize>where
I: Iterator<Item = NonZeroU32>,
Interprets pulse intervals from the provided iterator as bytes and writes them to the underlying writer as TAP chunks.
See PulseDecodeWriter.
Returns the number of TAP chunks written.
Auto Trait Implementations§
impl<W> Freeze for TapChunkWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for TapChunkWriter<W>where
W: RefUnwindSafe,
impl<W> Send for TapChunkWriter<W>where
W: Send,
impl<W> Sync for TapChunkWriter<W>where
W: Sync,
impl<W> Unpin for TapChunkWriter<W>where
W: Unpin,
impl<W> UnwindSafe for TapChunkWriter<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<S, T> IntoSample<S> for Twhere
S: FromSample<T>,
impl<S, T> IntoSample<S> for Twhere
S: FromSample<T>,
Source§fn into_sample(self) -> S
fn into_sample(self) -> S
S a sample type from self.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.