marshal
Binary Serialization
Constants
MARSHAL_NIL = 0MARSHAL_I64 = 1MARSHAL_STR = 2MARSHAL_ARRAY = 3MARSHAL_MAP = 4Functions
| Function | Description |
|---|---|
_msh_copy | |
_msh_write32 | Internal: write 4-byte LE integer. |
_msh_read32 | Internal: read 4-byte LE integer. |
_msh_write64 | Internal: write 8-byte LE integer. |
_msh_read64 | Internal: read 8-byte LE integer. |
marshal_nil | Write nil. Returns new offset. |
marshal_i64 | Write i64 value. Returns new offset. |
marshal_str | Write string. Returns new offset. |
marshal_array_begin | Write array header (type tag + count). Returns new offset. Caller must then w… |
marshal_map_begin | Write map header (type tag + pair count). Returns new offset. Caller must the… |
unmarshal_type | Peek type tag at offset. |
unmarshal_i64 | Read i64 value (skips type tag). Returns the value. |
unmarshal_str_len | Read string length at offset. |
unmarshal_str | Read string. Copies to out. Returns new offset (past string). |
unmarshal_array_count | Get array count at offset. |
unmarshal_skip | Skip one marshaled value. Returns new offset. |
Details
_msh_copy
fn _msh_copy(dst: &i8, doff: i64, src: &i8, soff: i64, n: i64)_msh_write32
fn _msh_write32(buf: &i8, off: i64, val: i64) -> i64Internal: write 4-byte LE integer.
_msh_read32
fn _msh_read32(buf: &i8, off: i64) -> i64Internal: read 4-byte LE integer.
_msh_write64
fn _msh_write64(buf: &i8, off: i64, val: i64) -> i64Internal: write 8-byte LE integer.
_msh_read64
fn _msh_read64(buf: &i8, off: i64) -> i64Internal: read 8-byte LE integer.
marshal_nil
fn marshal_nil(buf: &i8, off: i64) -> i64Write nil. Returns new offset.
marshal_i64
fn marshal_i64(buf: &i8, off: i64, val: i64) -> i64Write i64 value. Returns new offset.
marshal_str
fn marshal_str(buf: &i8, off: i64, s: &i8, slen: i64) -> i64Write string. Returns new offset.
marshal_array_begin
fn marshal_array_begin(buf: &i8, off: i64, count: i64) -> i64Write array header (type tag + count). Returns new offset.
Caller must then write count elements.
marshal_map_begin
fn marshal_map_begin(buf: &i8, off: i64, count: i64) -> i64Write map header (type tag + pair count). Returns new offset.
Caller must then write count key-value pairs.
unmarshal_type
fn unmarshal_type(buf: &i8, off: i64) -> i64Peek type tag at offset.
unmarshal_i64
fn unmarshal_i64(buf: &i8, off: i64) -> i64Read i64 value (skips type tag). Returns the value.
unmarshal_str_len
fn unmarshal_str_len(buf: &i8, off: i64) -> i64Read string length at offset.
unmarshal_str
fn unmarshal_str(buf: &i8, off: i64, out: &i8) -> i64Read string. Copies to out. Returns new offset (past string).
unmarshal_array_count
fn unmarshal_array_count(buf: &i8, off: i64) -> i64Get array count at offset.
unmarshal_skip
fn unmarshal_skip(buf: &i8, off: i64) -> i64Skip one marshaled value. Returns new offset.