pub trait ALPFloat:
Sealed
+ Float
+ Display
+ 'static {
type ALPInt: PrimInt + Display + ToPrimitive;
const FRACTIONAL_BITS: u8;
const MAX_EXPONENT: u8;
const SWEET: Self;
const F10: &'static [Self];
const IF10: &'static [Self];
// 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>) { ... }
fn encode_single(
value: Self,
exponents: Exponents,
) -> Result<Self::ALPInt, Self> { ... }
fn decode(encoded: &[Self::ALPInt], exponents: Exponents) -> Vec<Self> { ... }
fn decode_buffer(
encoded: BufferMut<Self::ALPInt>,
exponents: Exponents,
) -> BufferMut<Self> { ... }
fn decode_single(encoded: Self::ALPInt, exponents: Exponents) -> Self { ... }
unsafe 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
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>)
fn encode_single( value: Self, exponents: Exponents, ) -> Result<Self::ALPInt, Self>
fn decode(encoded: &[Self::ALPInt], exponents: Exponents) -> Vec<Self>
fn decode_buffer( encoded: BufferMut<Self::ALPInt>, exponents: Exponents, ) -> BufferMut<Self>
fn decode_single(encoded: Self::ALPInt, exponents: Exponents) -> Self
Sourceunsafe fn encode_single_unchecked(
value: Self,
exponents: Exponents,
) -> Self::ALPInt
unsafe fn encode_single_unchecked( value: Self, exponents: Exponents, ) -> Self::ALPInt
§Safety
The returned value may not decode back to the original value.
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.