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

I cant Deserialize a length more than 32 array #2723

Closed
v200123 opened this issue Apr 1, 2024 · 1 comment
Closed

I cant Deserialize a length more than 32 array #2723

v200123 opened this issue Apr 1, 2024 · 1 comment

Comments

@v200123
Copy link

v200123 commented Apr 1, 2024

for example,i have a strct field ” m_weather_forecast_samples: [WeatherForecastSample; 32] “,then when i build it,it will give me a error:

the trait bound `[WeatherForecastSample; 33]: Deserialize<'_>` is not satisfied
    --> src\eventModel.rs:226:33
     |
226  |     m_weather_forecast_samples: [WeatherForecastSample; 33],   // Array of weather forecast samples
     |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `[WeatherForecastSample; 33]`
     |
     = help: the following other types implement trait `Deserialize<'de>`:
               [T; 0]
               [T; 1]
               [T; 2]
               [T; 3]
               [T; 4]
               [T; 5]
               [T; 6]
               [T; 7]
             and 26 others
note: required by a bound in `next_element`
    --> C:\Users\lc\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.197\src\de\mod.rs:1726:12
     |
1724 |     fn next_element<T>(&mut self) -> Result<Option<T>, Self::Error>
     |        ------------ required by a bound in this associated function
1725 |     where
1726 |         T: Deserialize<'de>,
     |            ^^^^^^^^^^^^^^^^ required by this bound in `SeqAccess::next_element`

what happen?

@oli-obk
Copy link
Member

oli-obk commented Apr 2, 2024

We only implement the serialization traits for arrays up to length 32.

Supporting all array lengths is not easy, see #1937 for details

@oli-obk oli-obk closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants