pub fn sym_can_contain_somehow(
tag: SymStr,
child: SymStr,
) -> Option<Option<SymStr>>Expand description
The return type of this method is somewhat artisinal, as we have a three-way semantics:
None: There is no known structure that allowschildas a descendant oftagSome(None):childis directly allowed insidetagSome(Some(inter_tag)):childis allowed insideinter_tag, which is allowed intag
This could also (maybe more naturally?) be represented with a custom 3-valued enum.
That said, I think it may be wiser to refactor the method entirely, always requiring a bool
check, followed by an explicit request for the inner_tag name, which can be Option<SymStr>.