pathtracer/src/serialize/vector.rs
2020-03-18 14:31:33 +01:00

11 lines
261 B
Rust

use crate::Vector;
use serde::de::{Deserialize, Deserializer};
pub fn vector_normalizer<'de, D>(deserializer: D) -> Result<Vector, D::Error>
where
D: Deserializer<'de>,
{
let v: Vector = Deserialize::deserialize(deserializer)?;
Ok(v.normalize())
}