Trait vortex_alp::ALPFloat
source · 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, Vec<Self::ALPInt>, Vec<u64>, Vec<Self>) { ... }
fn encode_single(
value: Self,
exponents: Exponents,
) -> Result<Self::ALPInt, Self> { ... }
fn decode(encoded: &[Self::ALPInt], exponents: Exponents) -> Vec<Self> { ... }
fn decode_vec(encoded: Vec<Self::ALPInt>, exponents: Exponents) -> Vec<Self> { ... }
fn decode_single(encoded: Self::ALPInt, exponents: Exponents) -> Self { ... }
unsafe fn encode_single_unchecked(
value: Self,
exponents: Exponents,
) -> Self::ALPInt { ... }
}
Required Associated Types§
type ALPInt: PrimInt + Display + ToPrimitive
Required Associated Constants§
const FRACTIONAL_BITS: u8
const MAX_EXPONENT: u8
const SWEET: Self
const F10: &'static [Self]
const IF10: &'static [Self]
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, Vec<Self::ALPInt>, Vec<u64>, Vec<Self>)
fn encode_single( value: Self, exponents: Exponents, ) -> Result<Self::ALPInt, Self>
fn decode(encoded: &[Self::ALPInt], exponents: Exponents) -> Vec<Self>
fn decode_vec(encoded: Vec<Self::ALPInt>, exponents: Exponents) -> Vec<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.
Object Safety§
This trait is not object safe.