Expand description
Implements DcText and related formats DcList and DcUTF. These formats are
encodings for sequences of integer global graph IDs (which are long Dcs).
Format looks like (w/o backticks): Unicode (UTF-8) text @123@miesu@214748364@@L662@
where Unicode text is actual unicode text, and between each pair of @ signs, is a DcId. A DcId can be any int 128 bits (u128) in decimal, and it may have an L prefix.
Output format is sort of UTF-8 text. For normal Unicode input characters, the output character is the same. For DcIds less than or equal to 1114111 (the largest Unicode character, I believe), the output character is the corresponding “generalized UTF-8”, the numeric value encoded in the same underlying algorithm as UTF-8. For DcIds greater than 1114111 and not prefixed with an L, the output character is the decimal DcId represented by extending the usual algorithm of UTF-8 encoding, but for those larger numbers. For DcIds prefixed with an L, the output is equivalent to @1114408@ (short Dc 296) followed by a Dc number for the number that followed the L (the L is just a shorthand for that 1114408 Dc). That is to say, it’s not a true Unicode encoding, it’s simply using an extension of the algorithm underlying UTF-8 as a convenient encoding of ints.
Currently, DcList is used as the internal format for pivoting between other formats, but DcUtf might make more sense eventually for space efficiency.
Functions§
- dcarray_
to_ dclist - Converts an EITE DcArray (short Dcs,
&[u32]) to aDcList(Vec<u128>). - dcarray_
to_ dcstring - Parses a DcText document (
&[u8]) directly into aDcString. - dcarray_
to_ dctext - Converts an EITE DcArray (short Dcs,
&[u32]) to the DcText format (Vec<u8>). - dclist_
to_ dcarray - Converts a
DcList(&[u128]) to an EITE DcArray (short Dcs,Vec<u32>). - dclist_
to_ dctext - Serializes a
DcList(&[u128]) to DcText format bytes (Vec<u8>). - dclist_
to_ dctext_ with_ resolver - Serializes a
DcList(&[u128]) to DcText format bytes (Vec<u8>) using the given resolver. - dclist_
to_ dctf - Converts a
DcList(&[u128]) to DcTF bytes. - dclist_
to_ dcutf - Converts a
DcList(&[u128]) to legacy generalized UTF-8 bytes (DcUtf). - dcmstring_
to_ dctext - Converts a
DcMstringto DcText bytes. - dcstring_
to_ dcarray - Converts a
DcStrto an EITE DcArray (short Dcs,Vec<u32>). - dcstring_
to_ dctext - Serializes a
DcStrto DcText format bytes (Vec<u8>). - dctext_
to_ dcarray - Converts a DcText document (
&[u8]) to an EITE DcArray (short Dcs,Vec<u32>). - dctext_
to_ dclist - Parses a DcText document (
&[u8]) into aDcList(Vec<u128>). - dctext_
to_ dcmstring - Converts a DcText document to
DcMstring. - dctext_
to_ dcmstring_ with_ options - Converts a DcText document to
DcMstring, optionally in permissive mode. - dctext_
to_ dcstring - Parses a DcText document (
&[u8]) into aDcList(Vec<u128>). - dctext_
to_ dctf - Converts DcText format bytes to DcTF format bytes.
- dctext_
to_ dcutf - Converts DcText format bytes to legacy DcUtf format bytes.
- dctf_
to_ dclist - Decodes DcTF bytes into a
DcList(Vec<u128>). - dctf_
to_ dctext - Converts DcTF format bytes to DcText format bytes.
- dcutf_
to_ dclist - Decodes generalized UTF-8 bytes (
DcUtf) into aDcList(Vec<u128>). - dcutf_
to_ dctext - Converts legacy DcUtf format bytes to DcText format bytes.
- format_
blob_ preview - Formats a byte slice as a displayable preview string.
If
is_dctextis true, first converts DcText to plain text. If the text is displayable (only graphic/whitespace chars), truncates it to 60 chars and returns it. Otherwise, returns a<binary data: N bytes>preview.
Type Aliases§
- DcList
- A list of global graph Document Character IDs represented as
u128values.