pub struct Producer<'a> { /* private fields */ }Expand description
Writes the payload of the single in-flight frame in one or more chunks.
Borrows the parent group::Producer exclusively, so no other frame can be
opened while this one is live. The total bytes written must exactly match
Info::size; call Self::finish to commit the frame (or Self::abort to
fail it). Dropping without either aborts the group, since an unfinished frame
leaves the group’s stream broken.
A single whole-frame write keeps the caller’s allocation
(zero-copy); chunked writes copy into one buffer sized to the declared frame.
Implementations§
Source§impl<'a> Producer<'a>
impl<'a> Producer<'a>
Sourcepub fn write<B: IntoBytes>(&mut self, chunk: B) -> Result<()>
pub fn write<B: IntoBytes>(&mut self, chunk: B) -> Result<()>
Write a chunk of data to the frame.
Returns Error::WrongSize if the chunk would exceed the remaining bytes.
Sourcepub fn finish(self) -> Result<()>
pub fn finish(self) -> Result<()>
Commit the frame, verifying that all bytes were written.
Returns Error::WrongSize if the bytes written don’t match Info::size.