serde-rs / serde

Serialization framework for Rust
https://serde.rs/
Apache License 2.0
8.82k stars 748 forks source link

Just wonder what is the future or idealism way to ser or deser the big const sized array #2683

Closed uuhan closed 5 months ago

uuhan commented 5 months ago

I know there is an awesome crate serde-big-array to work with big array. But I have a, maybe rare, case that I can not add the

#[serde(with = "BigArray")]

to my structure's field which is generated by bindgen.

This can not be done with the current bidgen version. I just wonder if it is possible that the type [T; N] can be supported directly by serde.

hrxi commented 5 months ago

Duplicate of #1937 and #2518, you commented on the latter: https://github.com/serde-rs/serde/issues/2518#issuecomment-1905580520.

You could post-process the bindgen output to include the #[serde(with = "BigArray")] or fix bindgen to be able to add it.