Crates.io | idx-rs |
lib.rs | idx-rs |
version | 0.10.0 |
source | src |
created_at | 2021-12-08 04:12:28.107361 |
updated_at | 2021-12-19 00:07:32.304124 |
description | A fast and efficient library for working with IDX-formatted RuneScape caches. |
homepage | https://github.com/ceikry/idx |
repository | https://github.com/ceikry/idx |
max_upload_size | |
id | 494237 |
size | 75,872 |
This image proudly made in GIMP
Licensed under GNU GPL, Version 3.0, (LICENSE-GPL3 or https://choosealicense.com/licenses/gpl-3.0/)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the GPL-3.0 license, will be incorporated into the project under the full terms of the GPL-3.0 license.
I can not, will not, and don't want to provide a copy of any cache owned by Jagex. These are copyrighted assets and I do not encourage the violation of their copyright. These are up to you to source. A good resource is the OpenRS2 Archive.
IDX is actually relatively straightforward to use. If you just want to get a working example spun up as quick as possible, below is an example configuration that should get you going in no time.
Note that test_cache
in the below example should be replaced with the path to your IDX-formatted cache.
use std::sync::{Arc, Mutex};
use idx::*;
use idx::util::*;
use databuffer::DataBuffer;
fn main() {
let cache = Arc::from(Mutex::from(Cache::from_path("test_cache")));
let data_provider = FileProvider::from(&cache);
data_provider.index(19).archive(&1);
let mut data: DataBuffer = data_provider.request(&0); //This will return a DataBuffer containing the data from File 0, Archive 1, Index 19.
}
IDX's Cache
struct is designed to be wrapped in an Arc<Mutex<Cache>>
so that multiple references to it can be created at once.
Both the FileProvider
and DefProvider
leverage this to allow creation of multiple simultaneous file/definition providers.
For more information on FileProvider
and DefProvider
check the documentation on docs.rs, specifically: FileProvider and DefProvider.
IDX is very fast for what it has to do. Some of the speed obviously depends on whether you are using an SSD or HDD, but generally speaking, the speeds are substantial. Due to benchmarking thanks to Criterion, I am able to provide the below graphs benchmarking reading random files from Index 19.