pub struct GroupProducer { /* private fields */ }Expand description
Writes frames to a group in order.
Each group is delivered independently over a QUIC stream. Use Self::write_frame for simple single-buffer frames, or Self::create_frame for multi-chunk streaming writes.
Implementations§
Source§impl GroupProducer
impl GroupProducer
Sourcepub fn write_frame<B: Into<Bytes>>(&mut self, frame: B) -> Result<()>
pub fn write_frame<B: Into<Bytes>>(&mut self, frame: B) -> Result<()>
A helper method to write a frame from a single byte buffer.
If you want to write multiple chunks, use Self::create_frame to get a frame producer. But an upfront size is required.
Sourcepub fn create_frame(&mut self, info: Frame) -> Result<FrameProducer>
pub fn create_frame(&mut self, info: Frame) -> Result<FrameProducer>
Create a frame with an upfront size
Sourcepub fn append_frame(&mut self, frame: FrameProducer) -> Result<()>
pub fn append_frame(&mut self, frame: FrameProducer) -> Result<()>
Append a frame producer to the group.
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Return the number of frames written so far.
Sourcepub fn finish(&mut self) -> Result<()>
pub fn finish(&mut self) -> Result<()>
Mark the group as complete; no more frames will be written.
Sourcepub fn abort(&mut self, err: Error) -> Result<()>
pub fn abort(&mut self, err: Error) -> Result<()>
Abort the group with the given error.
No updates can be made after this point. Child frames are independent and must be aborted separately if desired; existing frame consumers can still finish reading any frames that were already created.
Sourcepub fn consume(&self) -> GroupConsumer
pub fn consume(&self) -> GroupConsumer
Create a new consumer for the group.