Trait bdk_chain::bitcoin::consensus::serde::EncodeBytes

pub trait EncodeBytes {
    // Required methods
    fn encode_chunk<W>(
        &mut self,
        writer: &mut W,
        bytes: &[u8]
    ) -> Result<(), Error>
       where W: Write;
    fn flush<W>(&mut self, writer: &mut W) -> Result<(), Error>
       where W: Write;
}
Expand description

Transforms given bytes and writes to the writer.

The encoder is allowed to be buffered (and probably should be). The design passing writer each time bypasses the need for GAT.

Required Methods§

fn encode_chunk<W>(&mut self, writer: &mut W, bytes: &[u8]) -> Result<(), Error>
where W: Write,

Transform the provided slice and write to the writer.

This is similar to the write_all method on io::Write.

fn flush<W>(&mut self, writer: &mut W) -> Result<(), Error>
where W: Write,

Write data in buffer (if any) to the writer.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<C> EncodeBytes for Encoder<C>
where C: Case,