Module dc_number

Module dc_number 

Source
Expand description

Document Character (Dc) numeric encoding and base64 encapsulation utilities.

Provides encoding and decoding of numbers in Dc streams using Base64 encapsulation digits (short Dcs 127..=190 and 195).

Standard structure of a Dc number:

  1. Dc 6 (Begin number)
  2. Dc for format 199 (Global Graph ID 2228423 or short Dc 199)
  3. Optional Dc 10 (Positive) or Dc 11 (Negative)
  4. Absolute value of integer converted to Base64 (using ctb_formats_math::base) and encoded as Base64 encapsulation Dcs (127..=190)
  5. Dc 7 (End number)

Structs§

DcChar
A single Document Character (Dc) or Unicode codepoint, represented as a 128-bit integer.

Constants§

DC_BASE64_END
Base 64 encapsulation digit 63 (Dc 190).
DC_BASE64_PADDING
Base 64 encapsulation padding character (Dc 195).
DC_BASE64_START
Base 64 encapsulation digit 0 (Dc 127).
DC_BEGIN_NUMBER
Begin a DCE number. (Dc 6).
DC_END_NUMBER
End a DCE number. (Dc 7).
DC_INTEGER
DcChar constant for Format Integer (Short f199, Category: number): Integer number
DC_NEGATIVE
Negative (syntactical representation — This is not the − character) (Dc 11).
DC_POSITIVE
Positive value (syntactical representation — This is not the + character) (Dc 10).

Traits§

DcCharExt
Extension methods for DcChar specific to document formats and serialization.

Functions§

base64_char_to_global_dc
Converts a single standard Base64 character or padding character (=) into its corresponding Global Graph ID.
base64_char_to_short_dc
Converts a single standard Base64 character or padding character (=) into its corresponding short Document Character (Dc) ID (127..=190, 195).
base64_str_to_global_dcs
Converts a string of standard Base64 characters into Global Graph IDs.
base64_str_to_short_dcs
Converts a string of standard Base64 characters and padding into a vector of short Document Characters (127..=190, 195).
dc_base64_char_to_digit
Converts a Base64 encapsulation DcChar into its 6-bit numeral value (0..=63) or padding sentinel (64).
dc_base64_digit_to_char
Converts a 6-bit Base64 numeral value (0..=63) or padding sentinel (64) into its corresponding Base64 encapsulation DcChar.
global_dc_to_base64_char
Converts a single Global Graph ID (in the Base64 encapsulation range) into its corresponding standard Base64 character or padding character (=).
global_dcs_to_base64_str
Converts a sequence of Global Graph IDs into a standard Base64 string.
i128_to_dc_number_chars
Converts an i128 integer into a sequence of DcChars.
i128_to_dc_number_global
Converts an i128 integer into a sequence of Global Graph IDs (DcList).
i128_to_dc_number_short
Converts an i128 integer into a sequence of short Document Characters (Dcs).
integer_to_dc_number_chars
Converts an Integer into a sequence of DcChars.
integer_to_dc_number_global
Converts an Integer into a sequence of Global Graph IDs (DcList).
integer_to_dc_number_short
Converts an Integer into a sequence of short Document Characters (Dcs).
is_dc_base64_encapsulation_char
Returns true if ch is a Base64 encapsulation digit (127..=190) or padding (195).
natural_to_dc_number_chars
Converts a Natural number (with an optional negative sign flag) into a sequence of DcChars.
natural_to_dc_number_global
Converts a Natural number (with an optional negative sign flag) into a sequence of Global Graph IDs (DcList).
natural_to_dc_number_short
Converts a Natural number (with an optional negative sign flag) into a sequence of short Document Characters (Dcs).
parse_dc_number_digits
Parses a slice of DcChar digits (with optional leading DC_NEGATIVE or DC_POSITIVE sign indicator, excluding the outer DC_BEGIN_NUMBER, format indicator, and DC_END_NUMBER delimiters) into an Integer.
parse_dc_number_digits_with_resolver
Parses a slice of DcChar digits using the provided SyntaxRuleResolver.
parse_dc_number_global
Parses an entire sequence of Global Graph IDs (DcList) as a single Dc number.
parse_dc_number_global_i128
Parses an entire sequence of Global Graph IDs (DcList) as an i128.
parse_dc_number_global_with_resolver
Parses an entire sequence of Global Graph IDs (DcList) as a single Dc number using the provided SyntaxRuleResolver.
parse_dc_number_short
Parses an entire sequence of short Document Characters (Dcs) as a single Dc number.
parse_dc_number_short_i128
Parses an entire sequence of short Document Characters (Dcs) as an i128.
parse_dc_number_short_with_resolver
Parses an entire sequence of short Document Characters (Dcs) as a single Dc number using the provided SyntaxRuleResolver.
read_dc_number_from_reader
Reads a single Dc number from a reader closure yielding DcChars.
read_dc_number_from_reader_with_resolver
read_dc_number_global
Reads a single Dc number from a slice of Global Graph IDs (DcList), returning the parsed Integer and the number of tokens consumed from the slice.
read_dc_number_global_with_resolver
Reads a single Dc number from a slice of Global Graph IDs (DcList) using the provided SyntaxRuleResolver.
read_dc_number_short
Reads a single Dc number from a slice of short Document Characters (Dcs), returning the parsed Integer and the number of tokens consumed from the slice.
read_dc_number_short_with_resolver
Reads a single Dc number from a slice of short Document Characters (Dcs) using the provided SyntaxRuleResolver.
short_dc_to_base64_char
Converts a single short Document Character (Dc) ID (127..=190, 195) into its corresponding standard Base64 character or padding character (=).
short_dcs_to_base64_str
Converts a sequence of short Document Characters (127..=190, 195) into a standard Base64 string.
u128_to_dc_number_chars
Converts a u128 unsigned integer into a sequence of DcChars.
u128_to_dc_number_global
Converts a u128 unsigned integer into a sequence of Global Graph IDs (DcList).
u128_to_dc_number_short
Converts a u128 unsigned integer into a sequence of short Document Characters (Dcs).