Merge pull request #870 from dimforge/dvector_serialize
Fix serialization of DVector
This commit is contained in:
commit
9e5e8e7b94
|
@ -211,6 +211,26 @@ pub trait DimName: Dim {
|
|||
fn dim() -> usize;
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde-serialize-no-std")]
|
||||
impl<const D: usize> Serialize for Const<D> {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
().serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde-serialize-no-std")]
|
||||
impl<'de, const D: usize> Deserialize<'de> for Const<D> {
|
||||
fn deserialize<Des>(deserializer: Des) -> Result<Self, Des::Error>
|
||||
where
|
||||
Des: Deserializer<'de>,
|
||||
{
|
||||
<()>::deserialize(deserializer).map(|_| Const::<D>)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ToConst {
|
||||
type Const: DimName;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue