Skip to main content

encode_words

Function encode_words 

Source
pub fn encode_words(ops: &[DomOp]) -> (Vec<i64>, Vec<String>)
Expand description

Word-oriented wire format v2: the same opcodes as encode/decode, but every operand is an i64 WORD and every string is a 1-based index into a separate STRING TABLE — the shape vdom.lg’s own emitter naturally produces (Seq of Int for the words, Seq of Text for the strings), with no byte-level length-prefixing to hand-roll in LOGOS. words/strings travel as a pair; a decoder given one without its matching other cannot make sense of either.

Unlike encode, no interning: every text operand is appended to the table in the order it is encountered, exactly as a straightforward LOGOS emitter that has no dictionary to consult would build one, so a byte-for-byte comparison against vdom.lg’s own output stays meaningful.