Crates.io | palettevec |
lib.rs | palettevec |
version | |
source | src |
created_at | 2025-01-05 21:27:11.623048 |
updated_at | 2025-01-07 18:43:48.757106 |
description | A palette compressed vector library for potentially insane runtime compression ratios. |
homepage | |
repository | https://github.com/alexdesander/palettevec |
max_upload_size | |
id | 1505065 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
PaletteVec is space efficient data structure for storing and managing items with a limited set of repeated elements, using a palette-based encoding scheme.
Palette compression has potential to save huge amounts of memory at runtime while still allowing for manipulation of the buffer elements. Most notably, palette compression is used in minecraft for block chunk storage. For most sophisticated voxel games, palette compression is a must.
Palette compression is also used in image compression (Indexed Color Images) and audio compression.
Creating and using a PaletteVec
:
use palettevec::PaletteVec;
fn main() {
let mut vec = PaletteVec::new();
// Push elements
vec.push("apple");
vec.push("banana");
vec.push("apple");
// Access elements
assert_eq!(vec[0], "apple");
assert_eq!(vec[1], "banana");
// Modify elements
vec.set(1, "cherry");
assert_eq!(vec[1], "cherry");
// Remove elements
assert_eq!(vec.pop(), Some(&"apple"));
// Iterate over elements
for item in &vec {
println!("{}", item);
}
// Optimizing the palette
vec.optimize();
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.