idsp/
build.rs

1/// Build a value using a context
2///
3/// This is similar to the `Into` trait but allows lossy
4/// (rounding, clamping, quantization) and non-value-preserving conversions.
5/// The only semantic constraint is that the conversion is obvious and unambiguous.
6pub trait Build<C> {
7    /// The context of the convesion.
8    ///
9    /// E.g. units.
10    type Context;
11
12    /// Perform the conversion
13    fn build(&self, ctx: &Self::Context) -> C;
14}