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
Within a task I'm currently trying to solve there is a need for async structs to initialize themselves and produce not just Self but Arc<Self>. At the same time I want them to support serde when necessary. But here comes a problem because neither approach I managed to dig up with google allows to, say, serde_toml::from_str(source) return an Arc<Self>. Perhaps remote parameter can help, but I'm not sure how well would it blend with from. Besides, it introduces another, rather unnecessary, layer of abstraction with introduction of RemoteSelf<Arc<Self>>.
Instead, for something like:
#[serde(from = "__FooShadow")]structFoo{...}
It would be much simpler and cleaner to implement something like the following pseudo-code:
It would be interesting to explore designs for this in a different serialization library, but I don't see this being something that would change in serde.
Within a task I'm currently trying to solve there is a need for async structs to initialize themselves and produce not just
Self
butArc<Self>
. At the same time I want them to support serde when necessary. But here comes a problem because neither approach I managed to dig up with google allows to, say,serde_toml::from_str(source)
return anArc<Self>
. Perhapsremote
parameter can help, but I'm not sure how well would it blend withfrom
. Besides, it introduces another, rather unnecessary, layer of abstraction with introduction ofRemoteSelf<Arc<Self>>
.Instead, for something like:
It would be much simpler and cleaner to implement something like the following pseudo-code:
The text was updated successfully, but these errors were encountered: