Skip to main content

Fixed

Trait Fixed 

Source
pub trait Fixed: Scalar { }
👎Deprecated since 0.2.0:

renamed to Scalar, which covers f32 and f64 as well as the Q formats

Expand description

The name of Scalar up to 0.1.5, kept so that bounds written V: Fixed still compile. Every Scalar is a Fixed; implement Scalar instead. Fixed has no items of its own, so paths that name them through it (<V as Fixed>::ONE, Fixed::div_int(..)) must name Scalar.

use tinymind::{Fixed, Q16_16};

// Code written against 0.1.5 keeps compiling (with a deprecation warning).
fn one<V: Fixed>() -> V {
    V::ONE
}
assert_eq!(one::<Q16_16>(), Q16_16::ONE);
assert_eq!(one::<f64>(), 1.0);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Scalar> Fixed for T