const TOK_START
XuAPI
pub const TOK_START = 1用途
常量 TOK_START,定义了相关的协议或算法配置参数。
#encoding/xml文本转义与 Decoder.token。无反射 Unmarshal。
const TOK_STARTpub const TOK_START = 1常量 TOK_START,定义了相关的协议或算法配置参数。
const TOK_ENDpub const TOK_END = 2常量 TOK_END,定义了相关的协议或算法配置参数。
const TOK_CHARpub const TOK_CHAR = 3常量 TOK_CHAR,定义了相关的协议或算法配置参数。
const TOK_COMMENTpub const TOK_COMMENT = 4常量 TOK_COMMENT,定义了相关的协议或算法配置参数。
struct Tokenpub struct Token {
pub kind int
pub name string
pub text string
pub keys []string
pub vals []string
}承载 kind、name、text、keys、vals 等属性的结构体。
kind intname stringtext stringkeys []stringvals []stringstruct Decoderpub struct Decoder {
pub data string
pub pos int
pub pending_end string
}承载 data、pos、pending_end 等属性的结构体。
data stringpos intpending_end stringnew_decoderpub fn new_decoder(src &string) Decoder构造 decoder。
src &stringDecoder — 该类型的值
(Decoder) input_offsetpub fn (d Decoder) input_offset() intDecoder 上的操作:执行 input offset 操作。
d DecoderDecoder 实例;按值接收。int — 该类型的值
escape_textpub fn escape_text(s &string) string转义文本。
s &stringstring — 结果字符串
escape_stringpub fn escape_string(s &string) string转义特殊字符。
s &stringstring — 结果字符串
unescape_stringpub fn unescape_string(s &string) string还原转义的实体或特殊字符序列。
s &stringstring — 结果字符串
($&Decoder) tokenpub fn (d $&Decoder) token() Token在 $&Decoder 上执行 token 操作。失败时抛出错误,调用方需处理或继续传播。
d $&DecoderDecoder 实例;以独占借用传入,方法可修改它,调用方仍持有实例。Token — 该类型的值
($&Decoder) skippub fn (d $&Decoder) skip() int$&Decoder 上的操作:跳过。失败时抛出错误,调用方需处理或继续传播。
d $&DecoderDecoder 实例;以独占借用传入,方法可修改它,调用方仍持有实例。int — 该类型的值