You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using html5ever in async code is painful, because of Cell in StrTendril. As far as I can tell, that choice is for performance reasons (the documentation claims that the use of non-thread-safe primitives is explained in README.md, but no such explanation exists anywhere I can find) but in my use case I'm quite happy to trade a bit of performance for massively enhanced ergonomics with async.
To that end, I'd like to see something which swaps out StrTendril (aka Tendril<UTF8, NonAtomic>) for Tendril<UTF8, Atomic>. A feature to enable atomicity seems reasonable, but there might be a better option. As far as I can tell that's a completely source-compatible change, so this can probably be implemented with something like:
and then replacing references to tendril::StrTendril with crate::H5ETendril.
Obviously the names can be bikeshedded. Those are the first ones I came up with.
Whether this belongs in this crate or tendril is also up for debate, but in my opinion: people using tendril directly already have plenty of ways to give themselves atomicity, and changing defaults through a feature there would just lead to dependency hell.
I can put in a PR, if it does turn out to be that simple.
The text was updated successfully, but these errors were encountered:
I just started messing with html5ever today (through scraper, FWIW) and immediately ran into this. Painful means possible, though, yes? If so, I would love some help. If the ergonomics work doesn't happen, an example or some documentation could go a long way. I'd be willing to offer my time doing that if I can get something working in the first place.
Using
html5ever
in async code is painful, because ofCell
inStrTendril
. As far as I can tell, that choice is for performance reasons (the documentation claims that the use of non-thread-safe primitives is explained inREADME.md
, but no such explanation exists anywhere I can find) but in my use case I'm quite happy to trade a bit of performance for massively enhanced ergonomics with async.To that end, I'd like to see something which swaps out
StrTendril
(akaTendril<UTF8, NonAtomic>
) forTendril<UTF8, Atomic>
. A feature to enable atomicity seems reasonable, but there might be a better option. As far as I can tell that's a completely source-compatible change, so this can probably be implemented with something like:and then replacing references to
tendril::StrTendril
withcrate::H5ETendril
.Obviously the names can be bikeshedded. Those are the first ones I came up with.
Whether this belongs in this crate or
tendril
is also up for debate, but in my opinion: people usingtendril
directly already have plenty of ways to give themselves atomicity, and changing defaults through a feature there would just lead to dependency hell.I can put in a PR, if it does turn out to be that simple.
The text was updated successfully, but these errors were encountered: