Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spanned elements #43

Open
ratmice opened this issue Apr 6, 2022 · 1 comment
Open

Spanned elements #43

ratmice opened this issue Apr 6, 2022 · 1 comment

Comments

@ratmice
Copy link

ratmice commented Apr 6, 2022

One thing which might be worth thinking about is whether the difference in data model allow deser to implement Spanned,
In the following comment dtolnay says serde's model is not necessarily byte oriented.
serde-rs/serde#1811 (comment)

if deser's model is, perhaps it could be worth including.

A few serde serializer/deserializer implementations implement it directly.

https://crates.io/crates/json-spanned-value
https://docs.rs/toml/latest/toml/struct.Spanned.html

But even with these, there are for instance odd interactions with Default.
Presumably a span for a default element could be one of None for an optional span type, or alternately the Span of any enclosing element?

Anyhow, it seemed worth thinking about perhaps, but doesn't seem to be essential.

@mitsuhiko
Copy link
Owner

The idea originally was that you can do things like Spanned through the context interface by using standardized types to attach information from the deserializer into the deserialization system. Unfortunately what I'm noticing as part of the existing implementation is that this is expensive with dynamic dispatch and I have not found a good way around this yet.

I do not want to give up on type erasure and dynamic dispatch yet, but I kinda ran into challenges with that which is why this has slowed down a bit right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants