Skip to content
Steve Ball edited this page Aug 8, 2021 · 13 revisions

Ideas for χrust

The new work in the dev branch uses traits to separate the XPath, XSLT and evaluator modules from the tree implementation. This is done in a polymorphic manner, using dynamic trait objects. The upside is that this allows different tree concrete types to be used: e.g. a roxmltree tree may be used to read the XSL stylesheet, a libxml tree may be used for the primary source document and a json tree may be created as the result tree. The downside is that this incurs a runtime performance penalty.

The alternative is to make the library monomorphic, i.e. only one concrete type is allowed at compile-time, so there is no runtime penalty. This would mean that the same tree implementation must be used at all times. After looking at serde, this might be possible by defining macros and compiler directives: e.g. #[derive(XPath, XSLT)]

Clone this wiki locally