This is a draft PR to use rustc_lexer to handle the FromStr implementation for TokenStream entirely within wasm (#18).
I'm pushing this up as a draft as I haven't run any tests on this implementation yet, nor have I benchmarked to see if it improves performance. Unfortunately I don't have a wa-serde-derive setup on my laptop right now, so it might be a bit before I get around to it.
In https://github.com/dtolnay/watt/issues/18#issue-515225393, it was suggested we could avoid parsing comments. I'm not sure that's possible, as macros can pass arbitrary strings into from_str, e.g. from a string literal, and we'd need to handle parsing them. If we decide not to support those callers some complexity could be eliminated by removing code related to doc comments.
This is a draft PR to use
rustc_lexer
to handle theFromStr
implementation forTokenStream
entirely within wasm (#18).I'm pushing this up as a draft as I haven't run any tests on this implementation yet, nor have I benchmarked to see if it improves performance. Unfortunately I don't have a wa-serde-derive setup on my laptop right now, so it might be a bit before I get around to it.
In https://github.com/dtolnay/watt/issues/18#issue-515225393, it was suggested we could avoid parsing comments. I'm not sure that's possible, as macros can pass arbitrary strings into
from_str
, e.g. from a string literal, and we'd need to handle parsing them. If we decide not to support those callers some complexity could be eliminated by removing code related to doc comments.