Skip to main content

write_with_scratch

Function write_with_scratch 

Source
pub fn write_with_scratch(
    repository: &impl Repository,
    scratch: &mut [u8],
    output: &mut impl Write,
) -> Result<ObjectId, Error>
Expand description

Stream borrowed, file-backed, or generated objects using caller-owned scratch. A nonempty buffer suffices for any body size; borrowed bodies need no scratch. Output is independent of the buffer size, preserving pack/cache identities. Errors invalidate partial output. Scratch is reused for each object; encoder and hash state are inline and independent of object/pack sizes.