Serialize statically sized matrices as tuples
Breaking change. Consistent with how serde serializes plain arrays.
This commit is contained in:
parent
4a5183ae59
commit
5c0e773242
|
@ -5,7 +5,7 @@ use std::ops::Mul;
|
||||||
#[cfg(feature = "serde-serialize-no-std")]
|
#[cfg(feature = "serde-serialize-no-std")]
|
||||||
use serde::de::{Error, SeqAccess, Visitor};
|
use serde::de::{Error, SeqAccess, Visitor};
|
||||||
#[cfg(feature = "serde-serialize-no-std")]
|
#[cfg(feature = "serde-serialize-no-std")]
|
||||||
use serde::ser::SerializeSeq;
|
use serde::ser::SerializeTuple;
|
||||||
#[cfg(feature = "serde-serialize-no-std")]
|
#[cfg(feature = "serde-serialize-no-std")]
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
#[cfg(feature = "serde-serialize-no-std")]
|
#[cfg(feature = "serde-serialize-no-std")]
|
||||||
|
@ -189,7 +189,7 @@ where
|
||||||
where
|
where
|
||||||
S: Serializer,
|
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() {
|
for e in self.as_slice().iter() {
|
||||||
serializer.serialize_element(e)?;
|
serializer.serialize_element(e)?;
|
||||||
|
@ -208,7 +208,7 @@ where
|
||||||
where
|
where
|
||||||
D: Deserializer<'a>,
|
D: Deserializer<'a>,
|
||||||
{
|
{
|
||||||
deserializer.deserialize_seq(ArrayStorageVisitor::new())
|
deserializer.deserialize_tuple(R * C, ArrayStorageVisitor::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue