const KIND_DICT
pub const KIND_DICT = 0用途
常量 KIND_DICT,定义了相关的协议或算法配置参数。
#encoding/xun带类型的块列表继承其标量类型,逐项验证,并在序列化时保留容器和元素标签。可安全表示的同类型非字符串列表可使用紧凑输出;字符串列表保留块形式。序列化拼写可能变化,请更新文本快照;若拼写不是契约的一部分,可比较解析树。旧的非空 !s[...] 标量输入仍被接受。
根以下容器的嵌套受 MAX_DEPTH(64)限制,包含行内、空容器和带类型容器。duration 校验拒绝格式错误或缺少单位的输入,并持续推进解析位置。多行解析将结构缩进与正文空白分别处理。
const KIND_DICTpub const KIND_DICT = 0常量 KIND_DICT,定义了相关的协议或算法配置参数。
const KIND_LISTpub const KIND_LIST = 1常量 KIND_LIST,定义了相关的协议或算法配置参数。
const KIND_SCALARpub const KIND_SCALAR = 2常量 KIND_SCALAR,定义了相关的协议或算法配置参数。
const MAX_BYTESpub const MAX_BYTES = 1048576常量 MAX_BYTES,定义了相关的协议或算法配置参数。
const MAX_DEPTHpub const MAX_DEPTH = 64常量 MAX_DEPTH,定义了相关的协议或算法配置参数。
struct Spanpub struct Span {
pub lo int
pub hi int
}承载 lo、hi 等属性的结构体。
lo inthi intstruct Docpub struct Doc {
pub kinds []int
pub tag_lo []int
pub tag_hi []int
pub text_lo []int
pub text_hi []int
pub key_lo []int
pub key_hi []int
pub key_hashes []int
pub firsts []int
pub nexts []int
pub lasts []int
pub buf string
pub root_idx int
pub err string
pub line int
pub line_starts []int
pub line_ends []int
pub i int
pub tok_kind int
pub tok_no int
pub tok_klo int
pub tok_khi int
pub tok_khash int
pub tok_vlo int
pub tok_vhi int
}承载 kinds、tag_lo、tag_hi、text_lo、text_hi 等属性的结构体。
kinds []inttag_lo []inttag_hi []inttext_lo []inttext_hi []intkey_lo []intkey_hi []intkey_hashes []intfirsts []intnexts []intlasts []intbuf stringroot_idx interr stringline intline_starts []intline_ends []inti inttok_kind inttok_no inttok_klo inttok_khi inttok_khash inttok_vlo inttok_vhi intnew_docpub fn new_doc() Doc构造 doc。
无需传入参数。
Doc — 该类型的值
(Doc) okpub fn (d Doc) ok() bool在 Doc 上执行 ok 操作。
d DocDoc 实例;按值接收。bool — 是否成立
(Doc) errorpub fn (d Doc) error() stringDoc 上的操作:错误。
d DocDoc 实例;按值接收。string — 结果字符串
(Doc) error_linepub fn (d Doc) error_line() intDoc 上的操作:执行 error line 操作。
d DocDoc 实例;按值接收。int — 该类型的值
(Doc) rootpub fn (d Doc) root() int在 Doc 上执行 root 操作。
d DocDoc 实例;按值接收。int — 该类型的值
(Doc) kindpub fn (d Doc) kind(n int) int在 Doc 上执行 kind 操作。
d DocDoc 实例;按值接收。n intint — 该类型的值
(Doc) is_dictpub fn (d Doc) is_dict(n int) boolDoc 上的操作:判断是否 dict。
d DocDoc 实例;按值接收。n intbool — 是否成立
(Doc) is_listpub fn (d Doc) is_list(n int) boolDoc 上的操作:判断是否 list。
d DocDoc 实例;按值接收。n intbool — 是否成立
(Doc) is_scalarpub fn (d Doc) is_scalar(n int) boolDoc 上的操作:判断是否 scalar。
d DocDoc 实例;按值接收。n intbool — 是否成立
(Doc) tagpub fn (d Doc) tag(n int) stringDoc 上的操作:标签。
d DocDoc 实例;按值接收。n intstring — 结果字符串
(Doc) textpub fn (d Doc) text(n int) stringDoc 上的操作:返回当前文本。
d DocDoc 实例;按值接收。n intstring — 结果字符串
(Doc) keypub fn (d Doc) key(n int) stringDoc 上的操作:键。
d DocDoc 实例;按值接收。n intstring — 结果字符串
(Doc) countpub fn (d Doc) count(n int) intDoc 上的操作:统计非重叠出现次数。
d DocDoc 实例;按值接收。n intint — 该类型的值
(Doc) atpub fn (d Doc) at(n int, i int) int在 Doc 上执行 at 操作。
d DocDoc 实例;按值接收。n inti intint — 该类型的值
(Doc) getpub fn (d Doc) get(n int, key string) int在 Doc 上执行 get 操作。
d DocDoc 实例;按值接收。n intkey stringint — 该类型的值
(Doc) as_strpub fn (d Doc) as_str(n int) stringDoc 上的操作:执行 as str 操作。
d DocDoc 实例;按值接收。n intstring — 结果字符串
(Doc) as_intpub fn (d Doc) as_int(n int) intDoc 上的操作:执行 as int 操作。
d DocDoc 实例;按值接收。n intint — 该类型的值
(Doc) as_f64pub fn (d Doc) as_f64(n int) f64Doc 上的操作:执行 as f64 操作。
d DocDoc 实例;按值接收。n intf64 — 该类型的值
(Doc) as_boolpub fn (d Doc) as_bool(n int) boolDoc 上的操作:执行 as bool 操作。
d DocDoc 实例;按值接收。n intbool — 是否成立
($&Doc) set_rootpub fn (d $&Doc) set_root(r int)$&Doc 上的操作:设置 root。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。r int不返回值。
($&Doc) new_nodepub fn (d $&Doc) new_node(kind int, tag string, text string, key string) int$&Doc 上的操作:构造 node。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。kind inttag stringtext stringkey stringint — 该类型的值
($&Doc) attachpub fn (d $&Doc) attach(parent int, child int)在 $&Doc 上执行 attach 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intchild int不返回值。
($&Doc) add_dictpub fn (d $&Doc) add_dict(parent int, key string) int$&Doc 上的操作:执行 add dict 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intkey stringint — 该类型的值
($&Doc) add_listpub fn (d $&Doc) add_list(parent int, key string) int$&Doc 上的操作:执行 add list 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intkey stringint — 该类型的值
($&Doc) add_scalarpub fn (d $&Doc) add_scalar(parent int, key string, tag string, text string) int$&Doc 上的操作:执行 add scalar 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intkey stringtag stringtext stringint — 该类型的值
($&Doc) add_strpub fn (d $&Doc) add_str(parent int, key string, val string) int$&Doc 上的操作:执行 add str 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intkey stringval stringint — 该类型的值
($&Doc) add_intpub fn (d $&Doc) add_int(parent int, key string, val int) int$&Doc 上的操作:执行 add int 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intkey stringval intint — 该类型的值
($&Doc) add_f64pub fn (d $&Doc) add_f64(parent int, key string, val f64) int$&Doc 上的操作:增加f64。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intkey stringval f64int — 该类型的值
($&Doc) add_boolpub fn (d $&Doc) add_bool(parent int, key string, val bool) int$&Doc 上的操作:执行 add bool 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intkey stringval boolint — 该类型的值
($&Doc) push_dictpub fn (d $&Doc) push_dict(parent int) int$&Doc 上的操作:执行 push dict 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intint — 该类型的值
($&Doc) push_listpub fn (d $&Doc) push_list(parent int) int$&Doc 上的操作:执行 push list 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intint — 该类型的值
($&Doc) push_scalarpub fn (d $&Doc) push_scalar(parent int, tag string, text string) int$&Doc 上的操作:执行 push scalar 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent inttag stringtext stringint — 该类型的值
($&Doc) push_strpub fn (d $&Doc) push_str(parent int, val string) int$&Doc 上的操作:执行 push str 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intval stringint — 该类型的值
($&Doc) push_intpub fn (d $&Doc) push_int(parent int, val int) int$&Doc 上的操作:执行 push int 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intval intint — 该类型的值
($&Doc) push_f64pub fn (d $&Doc) push_f64(parent int, val f64) int$&Doc 上的操作:压入f64。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intval f64int — 该类型的值
($&Doc) push_boolpub fn (d $&Doc) push_bool(parent int, val bool) int$&Doc 上的操作:执行 push bool 操作。
d $&DocDoc 实例;以独占借用传入,方法可修改它,调用方仍持有实例。parent intval boolint — 该类型的值
parsepub fn parse(src &string) Doc解析输入。
src &stringDoc — 该类型的值
decodepub fn decode(src &string) Doc从编码数据中还原原始数据。
src &stringDoc — 该类型的值
encodepub fn encode(d &Doc) string执行数据编码并返回结果。
d &Docstring — 结果字符串
(Doc) to_xunpub fn (d Doc) to_xun() stringDoc 上的操作:转换为 xun。
d DocDoc 实例;按值接收。string — 结果字符串