Expand description
Binary command buffer parser and mutation applicator.
Reads a command buffer produced by the JS CommandBuffer class, converts
commands into arena mutations, and returns the rebuilt arena.
§Wire format
All multi-byte integers are little-endian.
Commands (first byte): 0x01 REMOVE [nodeId: u32] 0x05 INSERT_BEFORE [nodeId: u32][payloadType: u8][payload…] 0x06 INSERT_AFTER [nodeId: u32][payloadType: u8][payload…] 0x07 PREPEND_CHILD [nodeId: u32][payloadType: u8][payload…] 0x08 APPEND_CHILD [nodeId: u32][payloadType: u8][payload…] 0x09 WRAP [nodeId: u32][payloadType: u8][payload…] 0x0B REPLACE [nodeId: u32][payloadType: u8][payload…] 0x0C SET_PROPERTY [nodeId: u32][valueType: u8][nameLen: u32][name…][valueLen: u32][value…]
Value types for SET_PROPERTY: 0 STRING : UTF-8 value 1 BOOL_TRUE : no value bytes 2 BOOL_FALSE : no value bytes 3 SPACE_SEP : space-separated list (UTF-8) 4 INT : value is decimal string, parsed to i64 5 NULL : no value bytes
Payload types: 0x10 RAW_MARKDOWN [len: u32][utf8…] 0x11 RAW_HTML [len: u32][utf8…] 0x12 SERDE_JSON [len: u32][utf8…]
Functions§
- apply_
commands - The
parse_markdowncallback avoids a circular dependency on theparsercrate. Set-property mutations are applied in-place on the arena; structural mutations are collected asPatchobjects and applied viarebuild().