simplify QmdlWriter

This commit is contained in:
Will Greenberg
2026-04-03 13:40:26 -07:00
parent 58c60c2661
commit 73e3c9a5c2
+3 -12
View File
@@ -37,18 +37,9 @@ where
pub async fn write_container(&mut self, container: &MessagesContainer) -> std::io::Result<()> {
for msg in &container.messages {
// for a gzipped file, we can't use `msg.data.len()` to
// determine the number of bytes written, so we have to
// manually do a `write_all()` type loop
let mut buf = Cursor::new(&msg.data);
loop {
let bytes_written = self.writer.write_buf(&mut buf).await?;
self.writer.flush().await?;
if bytes_written == 0 {
break;
}
self.total_uncompressed_bytes += bytes_written;
}
self.writer.write_all(&msg.data).await?;
self.writer.flush().await?;
self.total_uncompressed_bytes += msg.data.len();
}
Ok(())
}