georust / rstar

R*-tree spatial index for the Rust ecosystem
https://docs.rs/rstar
Apache License 2.0
384 stars 67 forks source link

rkyv compatible ? #167

Closed ThomasCartier closed 2 months ago

ThomasCartier commented 2 months ago

Hi, Is it an option for RTrees to be rkyv compatible ? It would avoid a deserialization step before reuse.

Thanks

adamreichold commented 2 months ago

I think we would need to provide an alternative variant of RTree which uses ArchivedVec instead of Vec under the hood, i.e. an ArchivedRTree which among other things could not be mutated.

So it appears possible but would require a significant amount of work and be a ongoing maintenance burden (to keep this synchronized).

As a rather shameless plug, I would like to reference my sif-rtree crate which basically is such an RTree with a customized flat representation and thereby also avoids the deserialization step by directly working on memory maps. Of course, this might not be interesting for you if your application already uses the rkyv ecosystem...

ThomasCartier commented 2 months ago

That's great actually! I will give it a spin.

I close the issue as it seems it does what I need. 👍

adamreichold commented 2 months ago

Fair enough. Have a look at https://gitlab.opencode.de/umwelt-info/metadaten/-/blob/main/src/index/bounding_box.rs if you would like a fully worked example for the mmap use case.