Merge pull request #1220 from Ralith/serde-array-tuples

Serialize statically sized matrices as tuples
This commit is contained in:
Sébastien Crozet 2023-04-07 16:21:48 +02:00 committed by GitHub
commit 248654bc17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ use std::ops::Mul;
#[cfg(feature = "serde-serialize-no-std")]
use serde::de::{Error, SeqAccess, Visitor};
#[cfg(feature = "serde-serialize-no-std")]
use serde::ser::SerializeSeq;
use serde::ser::SerializeTuple;
#[cfg(feature = "serde-serialize-no-std")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[cfg(feature = "serde-serialize-no-std")]
@ -189,7 +189,7 @@ where
where
S: Serializer,
{
let mut serializer = serializer.serialize_seq(Some(R * C))?;
let mut serializer = serializer.serialize_tuple(R * C)?;
for e in self.as_slice().iter() {
serializer.serialize_element(e)?;
@ -208,7 +208,7 @@ where
where
D: Deserializer<'a>,
{
deserializer.deserialize_seq(ArrayStorageVisitor::new())
deserializer.deserialize_tuple(R * C, ArrayStorageVisitor::new())
}
}