Skip to main content

encode_edit_group

Function encode_edit_group 

Source
pub fn encode_edit_group(
    edits: &[(CodeRange, &str)],
    out: &mut Vec<u8>,
) -> Result<(), ProtocolError>
Expand description

Encodes the edits of one grouped edit the way EditCodeGroup carries them, appending to out.

The blob is a u32 count, then one 24-byte record per edit (the range, then the text’s offset and length) and then the texts one after another. A text’s offset counts from the start of the texts, not from the start of the blob. Fails only where a count, a length or an offset does not fit a u32.