diff --git a/src/serialize/mod.rs b/src/serialize/mod.rs index e69de29..f2ad632 100644 --- a/src/serialize/mod.rs +++ b/src/serialize/mod.rs @@ -0,0 +1,2 @@ +pub mod vector; +pub use vector::*; diff --git a/src/serialize/vector.rs b/src/serialize/vector.rs new file mode 100644 index 0000000..3a354bf --- /dev/null +++ b/src/serialize/vector.rs @@ -0,0 +1,10 @@ +use crate::Vector; +use serde::de::{Deserialize, Deserializer}; + +pub fn vector_normalizer<'de, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + let v: Vector = Deserialize::deserialize(deserializer)?; + Ok(v.normalize()) +}