Skip to main content

write_frames

Function write_frames 

Source
pub fn write_frames<W, I>(w: &mut W, frames: I) -> Result<usize>
where W: Write, I: IntoIterator<Item = Frame>,
Expand description

Writes a sequence of frames to the given writer.

Each frame is serialized using write_frame and written in order.

§Arguments

  • w - The output writer.
  • frames - An iterable sequence of Frame values.

§Returns

The number of frames successfully written.

§Errors

Returns an error if writing to the output fails or if serializing any frame fails.

§Notes

This function consumes the provided iterator.

§Examples

let frames = vec![frame1, frame2, frame3];
let written = write_frames(&mut writer, frames)?;
assert_eq!(written, 3);