Function wordshk_tools::parse_content [−][src]
pub fn parse_content<'a>(
id: usize,
variants: Vec<Variant>
) -> BoxedParser<'a, Option<Entry>, ()>
Expand description
Parse the content of an Entry
id and variants are parsed by parse_dict and passed in to this function.
For example, here’s the content of the Entry for 奸爸爹
(pos:語句)(label:外來語)(label:潮語)(label:香港)
yue:#加油
eng:cheer up
jpn:頑張って(がんばって)
let id = 98634;
let variants = vec![(Variant {word: "奸爸爹".into(), prs: vec!["gaan1 baa1 de1".into()]})];
// which parses to:
Some(Entry {
id: id,
variants: variants,
poses: vec!["語句".into()],
labels: vec!["外來語".into(), "潮語".into(), "香港".into()],
sims: vec![],
ants: vec![],
refs: vec![],
imgs: vec![],
defs: vec![Def {
yue: vec![vec![(Link, "加油".into())]],
eng: Some(vec![vec![(Text, "cheer up".into())]]),
alts: vec![(AltLang::Jpn, vec![vec![(Text, "頑張って(がんばって)".into())]])],
egs: vec![],
}]
})