pub trait ALPFloat:
Sealed
+ Float
+ Display
+ NativePType {
type ALPInt: PrimInt + Display + ToPrimitive + Copy + NativePType + Into<PValue>;
const FRACTIONAL_BITS: u8;
const MAX_EXPONENT: u8;
const SWEET: Self;
const F10: &'static [Self];
const IF10: &'static [Self];
Show 15 methods
// Required methods
fn as_int(self) -> Self::ALPInt;
fn from_int(n: Self::ALPInt) -> Self;
// Provided methods
fn fast_round(self) -> Self { ... }
fn find_best_exponents(values: &[Self]) -> Exponents { ... }
fn estimate_encoded_size(
encoded: &[Self::ALPInt],
patches: &[Self],
) -> usize { ... }
fn encode(
values: &[Self],
exponents: Option<Exponents>,
) -> (Exponents, Buffer<Self::ALPInt>, Buffer<u64>, Buffer<Self>, BufferMut<u64>) { ... }
fn encode_single(value: Self, exponents: Exponents) -> Option<Self::ALPInt> { ... }
fn encode_above(value: Self, exponents: Exponents) -> Self::ALPInt { ... }
fn encode_below(value: Self, exponents: Exponents) -> Self::ALPInt { ... }
fn decode(encoded: &[Self::ALPInt], exponents: Exponents) -> Vec<Self> { ... }
fn decode_buffer(
encoded: BufferMut<Self::ALPInt>,
exponents: Exponents,
) -> BufferMut<Self> { ... }
fn decode_into(
encoded: &[Self::ALPInt],
exponents: Exponents,
output: &mut [Self],
) { ... }
fn decode_slice_inplace(encoded: &mut [Self::ALPInt], exponents: Exponents) { ... }
fn decode_single(encoded: Self::ALPInt, exponents: Exponents) -> Self { ... }
fn encode_single_unchecked(
value: Self,
exponents: Exponents,
) -> Self::ALPInt { ... }
}Required Associated Constants§
const FRACTIONAL_BITS: u8
const MAX_EXPONENT: u8
const SWEET: Self
const F10: &'static [Self]
const IF10: &'static [Self]
Required Associated Types§
type ALPInt: PrimInt + Display + ToPrimitive + Copy + NativePType + Into<PValue>
Required Methods§
Provided Methods§
Sourcefn fast_round(self) -> Self
fn fast_round(self) -> Self
Round to the nearest floating integer by shifting in and out of the low precision range.
fn find_best_exponents(values: &[Self]) -> Exponents
fn estimate_encoded_size(encoded: &[Self::ALPInt], patches: &[Self]) -> usize
fn encode( values: &[Self], exponents: Option<Exponents>, ) -> (Exponents, Buffer<Self::ALPInt>, Buffer<u64>, Buffer<Self>, BufferMut<u64>)
fn encode_single(value: Self, exponents: Exponents) -> Option<Self::ALPInt>
fn encode_above(value: Self, exponents: Exponents) -> Self::ALPInt
fn encode_below(value: Self, exponents: Exponents) -> Self::ALPInt
fn decode(encoded: &[Self::ALPInt], exponents: Exponents) -> Vec<Self>
fn decode_buffer( encoded: BufferMut<Self::ALPInt>, exponents: Exponents, ) -> BufferMut<Self>
fn decode_into( encoded: &[Self::ALPInt], exponents: Exponents, output: &mut [Self], )
fn decode_slice_inplace(encoded: &mut [Self::ALPInt], exponents: Exponents)
fn decode_single(encoded: Self::ALPInt, exponents: Exponents) -> Self
Sourcefn encode_single_unchecked(value: Self, exponents: Exponents) -> Self::ALPInt
fn encode_single_unchecked(value: Self, exponents: Exponents) -> Self::ALPInt
Encode single float value. The returned value might decode to a different value than passed in.
Consider using Self::encode_single if you want the checked version of this function.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.