Skip to main content

Module vs_codec

Module vs_codec 

Source
Expand description

The byte-level selector codec, re-exported alongside vs. The variation-selector byte codec (C2PA 2.4 Appendix A.8).

Maps a byte onto one invisible Unicode variation selector and back. Low nibble values 0x00..=0x0F use the Variation Selectors block (U+FE00..U+FE0F); the remaining 0x10..=0xFF use Variation Selectors Supplement (U+E0100..U+E01EF). The two ranges are contiguous in byte space, so the mapping is a bijection over all 256 byte values.

This module is the transport alphabet only. The framing that carries a Manifest Store (magic, version, length, payload) lives in crate::wrapper, and the content binding in crate::hardbinding.

Functionsยง

byte_to_vs
Map a byte to its variation selector (A.8 byteToVariationSelector).
decode_run
Decode a leading run of variation selectors from s, stopping at the first character that is not one. Returns the bytes and the byte offset in s where the run ended.
encode_run
Encode bytes as a bare run of variation selectors, with no marker or frame.
is_vs
Whether c is a variation selector usable by this codec.
vs_to_byte
Map a variation selector back to its byte, or None if c is not one (A.8 variationSelectorToByte).