pub(crate) fn write(output: &mut impl Write, bytes: &[u8]) -> Result<usize>
Write all bytes to the output, returning the number of bytes written.