georust / rstar

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

rstar with u32, u64, ... #147

Closed w14 closed 9 months ago

w14 commented 9 months ago

The train RTreeNum requires Signed.source. This doesn't work when you try to create an r-tree with points (u32, u32), or other unsigned ints.

You cannot implement Signed on u32, u64...because you can only implement traits in the file of the trait or the implemented object. Can you relax this assumption or add a workaround? I do not want the performance overhead of boxing or converting u32s.

adamreichold commented 9 months ago

You cannot implement Signed on u32, u64...because you can only implement traits in the file of the trait or the implemented object. Can you relax this assumption or add a workaround? I do not want the performance overhead of boxing or converting u32s.

If you want to workaround this, you already can by using a newtype wrapper struct MyU32(u32); on which you can implement any traits.

That said, the implementations of the various algorithms themselves currently make use of signedness where appropriate, so this is not something that can be relaxed without functional fallout.

adamreichold commented 9 months ago

Duplicate of #129