LP-XXX/moonmo/mo does not have a README file

    MoError

    pub suberror MoError {
    TruncatedHeader(actual_len~ : Int)
    InvalidMagic(magic~ : UInt)
    UnsupportedRevision(major~ : UInt, minor~ : UInt)
    InvalidTableRange(table~ : String, offset~ : UInt64, byte_len~ : UInt64, file_len~ : Int)
    OffsetOutOfBounds(table~ : String, index~ : Int, offset~ : UInt64, length~ : UInt64, file_len~ : Int)
    MissingNulTerminator(table~ : String, index~ : Int, expected_nul_at~ : UInt64)
    UnsortedOriginalTable(index~ : Int)
    DuplicateOriginalKey(index~ : Int)
    MalformedPluralOriginal(index~ : Int, nul_count~ : Int)
    UnsupportedCharset(declared~ : String)
    InvalidUtf8(table~ : String, index~ : Int, byte_offset~ : Int)
    } derive(Eq,
    Debug
    )

    Binary layout, key ordering or encoding failure. Indexed variants identify the offending row. Example: @mo.parse_mo(bytes) catch { _ => return }.
    impl Show for MoError

    Endianness

    pub enum Endianness {
    Little
    Big
    } derive(Eq,
    Debug
    )

    Byte order inferred from the four MO magic bytes. Example: file.header.endianness.
    impl Show for Endianness

    MoFile

    pub struct MoFile {
    header : MoHeader
    entries : Array[RawEntry]
    metadata : MoMetadata
    } derive(Eq,
    Debug
    )

    Validated revision-0 header, strictly sorted entries and extracted metadata. Example: file.entries.length().
    impl Show for MoFile

    MoHeader

    pub struct MoHeader {
    endianness : Endianness
    major_revision : UInt
    minor_revision : UInt
    num_strings : UInt
    orig_tab_offset : UInt
    trans_tab_offset : UInt
    hash_tab_size : UInt
    hash_tab_offset : UInt
    } derive(Eq,
    Debug
    )

    Validated revision, entry count and table coordinates in bytes from the file start. Example: file.header.num_strings.
    impl Show for MoHeader

    MoMetadata

    pub struct MoMetadata {
    raw_header : String?
    headers : Map[String, String]
    charset : String?
    plural_forms_raw : String?
    } derive(Eq,
    Debug
    )

    Decoded metadata with lowercase field names, an optional charset and the original header text. Example: file.metadata.headers.get("content-type").
    impl Show for MoMetadata

    RawEntry

    pub struct RawEntry {
    key_bytes : Bytes
    plural_orig_bytes : Bytes?
    trans_bytes : Bytes
    } derive(Eq,
    Debug
    )

    Owned, validated key and translation bytes. Plural originals and NUL-delimited translation slots retain their original encoding. Example: entry.plural_orig_bytes.
    impl Show for RawEntry

    parse_mo

    fn parse_mo(bytes : Bytes) -> MoFile raise MoError

    Read revision 0.0 in either byte order. Invalid headers, ranges, terminators, keys or encodings raise MoError. Example: @mo.parse_mo(bytes).