pub struct IntegerEncoding;
Expand description
Integer encoding.
In integer encoding, floating point numbers are converted to integer values by multiplying with a factor and discard everything after the decimal point. Depending on the multiplication factor this can change the precision but with a sufficiently large factor it is lossless. The integer values can then often be compressed with delta encoding which is the main motivation for it.
§Examples
use rdir_encoding::IntegerEncoding;
let data = [1.00, 1.00, 0.50];
let encoded = IntegerEncoding::encode(&data, 100).unwrap();
assert_eq!(encoded, vec![100, 100, 50]);
let decoded = IntegerEncoding::decode(&encoded, 100).unwrap();
assert_eq!(decoded, data);
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IntegerEncoding
impl RefUnwindSafe for IntegerEncoding
impl Send for IntegerEncoding
impl Sync for IntegerEncoding
impl Unpin for IntegerEncoding
impl UnwindSafe for IntegerEncoding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more