From b94bcb692d48ccd102fa2c994b448066745535d0 Mon Sep 17 00:00:00 2001 From: MM Date: Wed, 13 Nov 2024 09:10:08 +0100 Subject: [PATCH] add text --- README.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f6b80c3..58b057a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ A big thansk to [Patrick Zippenfenig](https://github.com/patrick-zippenfenig) fo ## Installation -Cargo should automaticall download, patch and build the turbopfor library. +Cargo should automatically download, patch and build the turbopfor library. ```shell cargo build @@ -119,7 +119,7 @@ println!("{:?}", output); The `output` `Vec` is -``` +```rust [0, 1, 2, 3, 0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0] @@ -127,6 +127,26 @@ The `output` `Vec` is Clearly, Trubopfor writes more than 4 `u32`s. +### turbopfor_rs::generic + +v0.4.1 introduces `turbopfor_rs::generic` that reorganizes the encoders and decoders under a single trait `Encoding` that has four implementations: + +- `StandardEncoding` for unsorted integer lists (using codec::dec and enc) +- `IncreasingEncoding` for increasing integer lists (using codec::ddec and denc) +- `StrictlyIncreasingEncoding` for strictly increasing integer lists (using codec::d1dec and d1enc) +- `ZigZagEncoding` for unsorted integer lists (using codec::zdec and zenc) + +```rust + let input: Vec = vec![4, 83, 23, 214, 255, 0, 2]; + let buf_len = StandardEncoding::::enc_buf_size(input.len()); + let mut buf = vec![0u8; 1024]; + assert!(buf.len() >= buf_len); + let size = StandardEncoding::::encode(&input, &mut buf); + println!("{}", size); +``` + +Having all functions under one trait facilitates generic programming. Otherwise there's nothing new, here. + ### Coverage | | bindings | wrapper | tests | | @@ -263,7 +283,7 @@ Exceptions: Information about buffer sizes is scattered all over the place: -- [Alignment and padding, Issue #59]([Alignment and tailing padding requirements for the decoder APIs · Issue #59 · powturbo/TurboPFor-Integer-Compression · GitHub](https://github.com/powturbo/TurboPFor-Integer-Compression/issues/59): +- [Alignment and padding, Issue #59]([Alignment and tailing padding requirements for the decoder APIs · Issue #59 · powturbo/TurboPFor-Integer-Compression · GitHub](https://github.com/powturbo/TurboPFor-Integer-Compression/issues/59)): - Alignment for input and output is not required