starAndHonor/fst/codec does not have a README file

    CodecError

    pub suberror CodecError {
    InvalidFormat(String)
    } derive(
    Debug
    )

    Malformed, unsupported, or internally inconsistent serialized data.
    pub(all) struct Header {
    version : UInt64
    fst_type : UInt64
    len : UInt64
    root : Int
    } derive(Eq,
    Debug
    )

    Header and footer metadata. len counts accepted keys, not stored nodes.

    Header::equal

    fn Header::equal(Header, Header) -> Bool

    Header::not_equal

    fn Header::not_equal(x : Header, y : Header) -> Bool

    Header::to_repr

    Node

    pub(all) struct Node {
    address : Int
    is_final : Bool
    final_output : UInt64
    transitions : Array[Transition]
    } derive(Eq,
    Debug
    )

    An owned, bounds-checked view of one decoded node.

    Node::equal

    fn Node::equal(Node, Node) -> Bool

    Node::not_equal

    fn Node::not_equal(x : Node, y : Node) -> Bool

    Node::to_repr

    Transition

    pub(all) struct Transition {
    input : Byte
    output : UInt64
    addr : Int
    } derive(Eq,
    Debug
    )

    A transition in ascending input-byte order. Address zero is the implicit final state; all other addresses point to the last byte of a stored node.

    Transition::equal

    fn Transition::equal(Transition, Transition) -> Bool

    Transition::not_equal

    fn Transition::not_equal(x : Transition, y : Transition) -> Bool

    begin

    fn begin(fst_type : UInt64) -> Array[Byte]

    Starts a version 3 FST. The type tag is opaque to the raw format.

    crc32c

    fn crc32c(data : Bytes) -> UInt

    Standard CRC32C, initialized and finalized with all bits inverted.

    finish

    fn finish(buffer : Array[Byte], root~ : Int, len~ : UInt64) -> Bytes

    Appends key count, root address, and masked CRC32C, returning owned bytes.

    masked_crc32c

    fn masked_crc32c(data : Bytes) -> UInt

    Snappy's masked CRC32C, as stored in the version 3 fst footer.

    read_header

    fn read_header(data : Bytes) -> Header raise CodecError

    Reads metadata for Rust fst versions 1, 2, and 3. This validates offsets; call verify as well to validate the graph, path outputs, and checksum.

    read_node

    fn read_node(data : Bytes, header : Header, address : Int) -> Node raise CodecError

    Safely decodes one node, including transition ordering and indexed input consistency. verify additionally checks referenced nodes and whole paths.

    verify

    fn verify(data : Bytes) -> Unit raise CodecError

    Validates every reachable node without recursive calls or key expansion. Backward-only edges rule out cycles. Dynamic programming on addresses checks the accepted-key count and every possible accumulated output for overflow.

    write_node

    fn write_node(buffer : Array[Byte], is_final : Bool, final_output : UInt64, transitions : Array[Transition]) -> Int

    Appends one node, selecting implicit-final, one-transition-next, one-transition, or general encoding. Inputs must be sorted and unique; targets must already have been written, or be the implicit address zero.