pub struct FrameProducer {
pub info: Frame,
/* private fields */
}Expand description
Writes a frame’s payload in one or more chunks.
The total bytes written must exactly match Frame::size. Call Self::finish after writing all bytes to verify correctness.
Fields§
§info: FrameThe frame header containing the expected size.
Implementations§
Source§impl FrameProducer
impl FrameProducer
Sourcepub fn write<B: Into<Bytes>>(&mut self, chunk: B) -> Result<()>
pub fn write<B: Into<Bytes>>(&mut self, chunk: B) -> Result<()>
Write a chunk of data to the frame.
Returns Error::WrongSize if the total bytes written would exceed Frame::size.
Sourcepub fn write_chunk<B: Into<Bytes>>(&mut self, chunk: B) -> Result<()>
👎Deprecated: use write(chunk) instead
pub fn write_chunk<B: Into<Bytes>>(&mut self, chunk: B) -> Result<()>
Write a chunk of data to the frame.
Deprecated: use Self::write instead.
Sourcepub fn finish(&mut self) -> Result<()>
pub fn finish(&mut self) -> Result<()>
Verify that all bytes have been written.
Returns Error::WrongSize if the bytes written don’t match Frame::size.
Sourcepub fn consume(&self) -> FrameConsumer
pub fn consume(&self) -> FrameConsumer
Create a new consumer for the frame.
Trait Implementations§
Source§impl Clone for FrameProducer
impl Clone for FrameProducer
Auto Trait Implementations§
impl Freeze for FrameProducer
impl RefUnwindSafe for FrameProducer
impl Send for FrameProducer
impl Sync for FrameProducer
impl Unpin for FrameProducer
impl UnsafeUnpin for FrameProducer
impl UnwindSafe for FrameProducer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more