Open adamreichold opened 3 years ago
This is how it was originally implemented in outline
. However, with my still limited Rust experience I was facing a lot of problems when starting to implement to multi-file features (IIRC), so I switched to copying. But we may give it a try.
The current document model around the
Node
type contains a large number of separately allocatedString
instances which however are often (or possibly even always?) substrings into the text of the source file. Hence, it would be much more efficient to store string slices&'a str
within the document that borrow from the source file which is read into memory viafs::read_to_string
anyway. (Of course, this implies that the source file contents must outlive the parsed document.)