pub struct Encoder<S, W: Write> { /* private fields */ }Expand description
WARC format writer
Implementations§
Source§impl<W: Write> Encoder<EncStateHeader, W>
impl<W: Write> Encoder<EncStateHeader, W>
Sourcepub fn new(dest: W, config: EncoderConfig) -> Self
pub fn new(dest: W, config: EncoderConfig) -> Self
Create a new encoder.
The destination writer should not be a compression stream. To enable
compression, you must configure it with EncoderConfig.
Sourcepub fn write_header(
self,
header: &WarcHeader,
) -> Result<Encoder<EncStateBlock, W>, GeneralError>
pub fn write_header( self, header: &WarcHeader, ) -> Result<Encoder<EncStateBlock, W>, GeneralError>
Start a new WARC record with a given header.
The validation function will be called on the header before writing it to the stream.
Consumes the writer and returns a writer that has typestate transitioned to writing the WARC block portion of the record.
Source§impl<W: Write> Encoder<EncStateBlock, W>
impl<W: Write> Encoder<EncStateBlock, W>
Sourcepub fn finish_block(self) -> Result<Encoder<EncStateHeader, W>>
pub fn finish_block(self) -> Result<Encoder<EncStateHeader, W>>
Indicate writing the block portion of a WARC record has completed.
Consumes the writer and returns a typestate transitioned writer for writing a new record.
Trait Implementations§
Source§impl<W: Write> Write for Encoder<EncStateBlock, W>
impl<W: Write> Write for Encoder<EncStateBlock, W>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl<S, W> Freeze for Encoder<S, W>
impl<S, W> !RefUnwindSafe for Encoder<S, W>
impl<S, W> Send for Encoder<S, W>
impl<S, W> Sync for Encoder<S, W>
impl<S, W> Unpin for Encoder<S, W>
impl<S, W> !UnwindSafe for Encoder<S, W>
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
Mutably borrows from an owned value. Read more