struct Attr
XuAPI
pub struct Attr {
pub key string
pub value string
}用途
承载 key、value 等属性的结构体。
公开字段
keystring- 键
valuestring- 字段(string)
#html/query标准库包 `#html/query`。
struct Attrpub struct Attr {
pub key string
pub value string
}承载 key、value 等属性的结构体。
key stringvalue stringstruct Docpub struct Doc {
pub tags []string
pub texts []string
pub firsts []int
pub nexts []int
pub parents []int
pub attr_keys []string
pub attr_vals []string
pub attr_next []int
pub attr_head []int
}承载 tags、texts、firsts、nexts、parents 等属性的结构体。
tags []stringtexts []stringfirsts []intnexts []intparents []intattr_keys []stringattr_vals []stringattr_next []intattr_head []intparsepub fn parse(html0 string) Doc解析输入。
html0 stringDoc — 该类型的值
(&Doc) rootpub fn (d &Doc) root() int在 &Doc 上执行 root 操作。
d &DocDoc 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
(&Doc) tagpub fn (d &Doc) tag(n int) string&Doc 上的操作:标签。
d &DocDoc 实例;以只读借用传入,调用方仍持有实例。n intstring — 结果字符串
(&Doc) attrpub fn (d &Doc) attr(n int, key string) string在 &Doc 上执行 attr 操作。
d &DocDoc 实例;以只读借用传入,调用方仍持有实例。n intkey stringstring — 结果字符串
(&Doc) text_contentpub fn (d &Doc) text_content(n int) string&Doc 上的操作:执行 text content 操作。
d &DocDoc 实例;以只读借用传入,调用方仍持有实例。n intstring — 结果字符串
(&Doc) query_allpub fn (d &Doc) query_all(selector string) []int&Doc 上的操作:执行 query all 操作。
d &DocDoc 实例;以只读借用传入,调用方仍持有实例。selector string[]int — 切片结果
(&Doc) querypub fn (d &Doc) query(selector string) int&Doc 上的操作:查询串。
d &DocDoc 实例;以只读借用传入,调用方仍持有实例。selector stringint — 该类型的值