Skip to main content

Module codec

Module codec 

Source
Expand description

Python wrappers for the standalone spvirit-codec encoder/decoder.

Exposes introspection types (FieldDesc, StructureDesc), packet-level decoding of pvData buffers, and encoding helpers usable without any network IO.

Structs§

PyFieldDesc
A single field description: name and a type string (e.g. “int32”, “double[]”, “struct”, “struct[]”, “union”, “any”, “string[5]”).
PyStructureDesc
Structure type description: optional struct ID plus ordered fields.

Functions§

decode_introspection
Decode a StructureDesc from raw introspection bytes (the PVD field description as seen on the wire).
decode_packet
Best-effort inspection of a full PVA packet (header + payload). Returns a dict with command, command_name, version, flags, and a details sub-dict describing the command-specific payload.
decode_value
Decode a pvData value given the accompanying StructureDesc.
encode_put_payload
Encode a PUT payload (size-prefixed bitset + field data) for the given structure description and value dict. The bitset is built from the field keys present in value so callers only transmit changed fields.
encode_pv_request
Encode a pvRequest mask selecting specific top-level fields. Pass an empty list or None to request all fields.
extract_nt_value
Extract the inner value field from an NT structure dict. Returns None if the input is not an NT structure.
format_value
Compact single-line representation of a decoded value. Accepts any Python object that was produced by decode_value or by this crate’s GET result conversion; non-NT inputs are round-tripped via their string form.
register
Register the spvirit.codec submodule.