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 new(info: Group) -> GroupProducer
pub fn new(info: Group) -> GroupProducer
Create a new group producer.
Sourcepub fn write_frame<B>(&mut self, frame: B) -> Result<(), Error>
pub fn write_frame<B>(&mut self, frame: B) -> Result<(), Error>
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, Error>
pub fn create_frame(&mut self, info: Frame) -> Result<FrameProducer, Error>
Create a frame with an upfront size
Sourcepub fn append_frame(&mut self, frame: FrameProducer) -> Result<(), Error>
pub fn append_frame(&mut self, frame: FrameProducer) -> Result<(), Error>
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<(), Error>
pub fn finish(&mut self) -> Result<(), Error>
Mark the group as complete; no more frames will be written.
Sourcepub fn abort(&mut self, err: Error) -> Result<(), Error>
pub fn abort(&mut self, err: Error) -> Result<(), Error>
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.
Trait Implementations§
Source§impl Clone for GroupProducer
impl Clone for GroupProducer
Source§fn clone(&self) -> GroupProducer
fn clone(&self) -> GroupProducer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more