const kind_dict
pub const kind_dict = 0Purpose
Public constant `kind_dict`. Value `0`.
Parameters
none
API
#encoding/xunXUN documents. parse yields a pooled Doc.
const kind_dictpub const kind_dict = 0Public constant `kind_dict`. Value `0`.
none
const kind_listpub const kind_list = 1Public constant `kind_list`. Value `1`.
none
const kind_scalarpub const kind_scalar = 2Public constant `kind_scalar`. Value `2`.
none
const max_bytespub const max_bytes = 1048576Public constant `max_bytes`. Value `1048576`.
none
const max_depthpub const max_depth = 64Public constant `max_depth`. Value `64`.
none
struct Docpub struct Doc {
pub kinds []int
pub tags []string
pub texts []string
pub keys []string
pub firsts []int
pub nexts []int
pub lasts []int
pub root_idx int
pub err string
pub line int
pub lines []string
pub nos []int
pub i int
pub tok_kind int
pub tok_no int
pub tok_key string
pub tok_inline string
}Public struct `Doc`.
kinds []inttags []stringtexts []stringkeys []stringfirsts []intnexts []intlasts []introot_idx interr stringline intlines []stringnos []inti inttok_kind inttok_no inttok_key stringtok_inline stringnew_docpub fn new_doc() DocConstruct doc.
none
Doc — a value of this type
(Doc) okpub fn (d Doc) ok() bool===== public API =====
d Docbool — true or false
(Doc) errorpub fn (d Doc) error() stringCall `error` on `Doc`.
d Docstring — result string
(Doc) error_linepub fn (d Doc) error_line() intMethod on `Doc`: error line.
d Docint — a value of this type
(Doc) rootpub fn (d Doc) root() intCall `root` on `Doc`.
d Docint — a value of this type
(Doc) kindpub fn (d Doc) kind(n int) intCall `kind` on `Doc`.
d Docn intint — a value of this type
(Doc) is_dictpub fn (d Doc) is_dict(n int) boolMethod on `Doc`: whether it is dict.
d Docn intbool — true or false
(Doc) is_listpub fn (d Doc) is_list(n int) boolMethod on `Doc`: whether it is list.
d Docn intbool — true or false
(Doc) is_scalarpub fn (d Doc) is_scalar(n int) boolMethod on `Doc`: whether it is scalar.
d Docn intbool — true or false
(Doc) tagpub fn (d Doc) tag(n int) stringCall `tag` on `Doc`.
d Docn intstring — result string
(Doc) textpub fn (d Doc) text(n int) stringMethod on `Doc`: return the current text.
d Docn intstring — result string
(Doc) keypub fn (d Doc) key(n int) stringCall `key` on `Doc`.
d Docn intstring — result string
(Doc) countpub fn (d Doc) count(n int) intMethod on `Doc`: count non-overlapping occurrences.
d Docn intint — a value of this type
(Doc) atpub fn (d Doc) at(n int, i int) intCall `at` on `Doc`.
d Docn inti intint — a value of this type
(Doc) getpub fn (d Doc) get(n int, key string) intCall `get` on `Doc`.
d Docn intkey stringint — a value of this type
(Doc) as_strpub fn (d Doc) as_str(n int) string===== typed value accessors =====
d Docn intstring — result string
(Doc) as_intpub fn (d Doc) as_int(n int) intMethod on `Doc`: as int.
d Docn intint — a value of this type
(Doc) as_f64pub fn (d Doc) as_f64(n int) f64Method on `Doc`: as f64.
d Docn intf64 — a value of this type
(Doc) as_boolpub fn (d Doc) as_bool(n int) boolMethod on `Doc`: as bool.
d Docn intbool — true or false
(&mut Doc) set_rootpub fn (d &mut Doc) set_root(r int)===== node construction / tree building API =====
d &mut Docr int(&mut Doc) new_nodepub fn (d &mut Doc) new_node(kind int, tag string, text string, key string) intMethod on `&mut Doc`: construct node.
d &mut Dockind inttag stringtext stringkey stringint — a value of this type
(&mut Doc) attachpub fn (d &mut Doc) attach(parent int, child int)Call `attach` on `&mut Doc`.
d &mut Docparent intchild int(&mut Doc) add_dictpub fn (d &mut Doc) add_dict(parent int, key string) intMethod on `&mut Doc`: add dict.
d &mut Docparent intkey stringint — a value of this type
(&mut Doc) add_listpub fn (d &mut Doc) add_list(parent int, key string) intMethod on `&mut Doc`: add list.
d &mut Docparent intkey stringint — a value of this type
(&mut Doc) add_scalarpub fn (d &mut Doc) add_scalar(parent int, key string, tag string, text string) intMethod on `&mut Doc`: add scalar.
d &mut Docparent intkey stringtag stringtext stringint — a value of this type
(&mut Doc) add_strpub fn (d &mut Doc) add_str(parent int, key string, val string) intMethod on `&mut Doc`: add str.
d &mut Docparent intkey stringval stringint — a value of this type
(&mut Doc) add_intpub fn (d &mut Doc) add_int(parent int, key string, val int) intMethod on `&mut Doc`: add int.
d &mut Docparent intkey stringval intint — a value of this type
(&mut Doc) add_f64pub fn (d &mut Doc) add_f64(parent int, key string, val f64) intMethod on `&mut Doc`: add f64.
d &mut Docparent intkey stringval f64int — a value of this type
(&mut Doc) add_boolpub fn (d &mut Doc) add_bool(parent int, key string, val bool) intMethod on `&mut Doc`: add bool.
d &mut Docparent intkey stringval boolint — a value of this type
(&mut Doc) push_dictpub fn (d &mut Doc) push_dict(parent int) intMethod on `&mut Doc`: push dict.
d &mut Docparent intint — a value of this type
(&mut Doc) push_listpub fn (d &mut Doc) push_list(parent int) intMethod on `&mut Doc`: push list.
d &mut Docparent intint — a value of this type
(&mut Doc) push_scalarpub fn (d &mut Doc) push_scalar(parent int, tag string, text string) intMethod on `&mut Doc`: push scalar.
d &mut Docparent inttag stringtext stringint — a value of this type
(&mut Doc) push_strpub fn (d &mut Doc) push_str(parent int, val string) intMethod on `&mut Doc`: push str.
d &mut Docparent intval stringint — a value of this type
(&mut Doc) push_intpub fn (d &mut Doc) push_int(parent int, val int) intMethod on `&mut Doc`: push int.
d &mut Docparent intval intint — a value of this type
(&mut Doc) push_f64pub fn (d &mut Doc) push_f64(parent int, val f64) intMethod on `&mut Doc`: push f64.
d &mut Docparent intval f64int — a value of this type
(&mut Doc) push_boolpub fn (d &mut Doc) push_bool(parent int, val bool) intMethod on `&mut Doc`: push bool.
d &mut Docparent intval boolint — a value of this type
parsepub fn parse(src &string) Doc===== parse =====
src &stringDoc — a value of this type
encodepub fn encode(d &Doc) stringEncode.
d &Docstring — result string
(Doc) to_xunpub fn (d Doc) to_xun() stringMethod on `Doc`: convert to xun.
d Docstring — result string