forked from M-Labs/nalgebra
Fix serialization of DVector
This commit is contained in:
parent
c5c6c139ab
commit
f70e7f77d1
@ -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
Block a user