This necessarily uses two wrapper types: one to delegate to Serializer::collect_str, and since that uses Display, one to implement Display by forwarding to Debug.
The benefit is that any data format serializer that specializes collect_str (such as serde_json) will now be able to skip the temporary String allocation.
Fixes these
FIXME
s:https://github.com/rust-analyzer/rowan/blob/a00ccb60ea99eccbc7f24d31ee83e925e0d8258d/src/serde_impls.rs#L14-L15 https://github.com/rust-analyzer/rowan/blob/a00ccb60ea99eccbc7f24d31ee83e925e0d8258d/src/serde_impls.rs#L28-L29
This necessarily uses two wrapper types: one to delegate to
Serializer::collect_str
, and since that usesDisplay
, one to implementDisplay
by forwarding toDebug
.The benefit is that any data format serializer that specializes
collect_str
(such asserde_json
) will now be able to skip the temporaryString
allocation.