library: document serialize module
This commit is contained in:
parent
614217d33e
commit
94ab40413a
|
@ -1,3 +1,6 @@
|
||||||
|
//! Helper functions deserialize coefficients.
|
||||||
|
|
||||||
|
/// Returns the identity for a f32, i.e. 1.0.
|
||||||
pub fn default_identity() -> f32 {
|
pub fn default_identity() -> f32 {
|
||||||
1.
|
1.
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Helper functions to help scene (de)serialization
|
||||||
|
|
||||||
pub mod vector;
|
pub mod vector;
|
||||||
pub use vector::*;
|
pub use vector::*;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
|
//! Helper functions to deserialize `Vector` values.
|
||||||
|
|
||||||
use crate::Vector;
|
use crate::Vector;
|
||||||
use serde::de::{Deserialize, Deserializer};
|
use serde::de::{Deserialize, Deserializer};
|
||||||
|
|
||||||
|
/// Deserialize a vector.
|
||||||
|
///
|
||||||
|
/// Needs a custom implementation to make sur the vector is normalized when deserialized.
|
||||||
pub fn vector_normalizer<'de, D>(deserializer: D) -> Result<Vector, D::Error>
|
pub fn vector_normalizer<'de, D>(deserializer: D) -> Result<Vector, D::Error>
|
||||||
where
|
where
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
|
|
Loading…
Reference in a new issue