mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-14 22:35:26 +00:00
Merge fixup: keep the streaming designcraft_format::write
This commit is contained in:
1 parent
0fc62ec30b
commit
12e0e2341c
1 file changed
-10
@@ -59,16 +59,6 @@ pub fn write<W: std::io::Write + std::io::Seek>(out: &mut W, doc: &Document, pre
|
||||
craft_designcraft_format::write_to(out, &compact, concat!("DesignCraft ", env!("CARGO_PKG_VERSION")), preview, &assets, &proxies)
|
||||
}
|
||||
|
||||
/// [`save_with_preview`] into `out`, in chunks, so a writer that stops on cancellation stops the
|
||||
/// write at its next chunk.
|
||||
pub fn write<W: std::io::Write>(out: &mut W, doc: &Document, preview: Option<&[u8]>) -> Result<(), FormatError> {
|
||||
let bytes = save_with_preview(doc, preview)?;
|
||||
for chunk in bytes.chunks(1 << 20) {
|
||||
out.write_all(chunk).map_err(|e| FormatError::Io(e.to_string()))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Required native format version for a document. Kept for app-side compatibility; inference is
|
||||
/// performed by the shared codec over the serialized neutral document schema.
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user