Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The solution here is not entirely clear.
On the one hand, it would be much more efficient to drag links (& str), because copying them or extracting the link to the subslice is very cheap. This will allow structures to be created and discarded when parsed without regard to the overhead from owning the String.
On the other hand, by using references, you commit yourself to ensuring that the original string will live longer than your AST. It imposes decent restrictions on your code.
In any case, I would recommend using &str. However, without code, I can’t tell you how best to save the original String until the end of the request processing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question