Skip to main content

AsyncByteSink

Trait AsyncByteSink 

Source
pub trait AsyncByteSink {
    // Required method
    fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> BoxFuture<'a, Result<()>>;
}
Expand description

Accepts emitted file bytes, awaiting whatever I/O that takes.

This is the trait the shared emission algorithm is written against. BoxFuture is Send-bounded, so an implementation over a non-Send writer must do its work eagerly and return an already-complete future — as Immediate does — rather than capture the writer.

Required Methods§

Source

fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> BoxFuture<'a, Result<()>>

Writes all of buf, erroring if any byte cannot be accepted.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AsyncByteSink for Vec<u8>

The in-memory sink: bytes accumulate in the vector and the returned future is already complete.

Source§

fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> BoxFuture<'a, Result<()>>

Source§

impl<S: AsyncByteSink + ?Sized> AsyncByteSink for &mut S

An exclusive reference to a sink is itself a sink, forwarding the write — the write-side counterpart of pdfboss_core::source’s &T impl, and what lets a caller keep one sink across several by-value entry-point calls.

Source§

fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> BoxFuture<'a, Result<()>>

Implementors§