Giter VIP home page Giter VIP logo

Comments (6)

Albibek avatar Albibek commented on May 30, 2024

Hi.
The hard thing here is to decide about how endianness will be handled. Depending of the architecture, i.e. u64 can be converted to vectors with different byte orders.
I think I could implement this, but the resulting vector endianness should be decided first.

from rust_radix_trie.

michaelsproul avatar michaelsproul commented on May 30, 2024

Hi!

Thanks for your interest in contributing! We could possibly integrate with this package:

https://docs.rs/endian-type/0.1.2/endian_type/

By default, we could also provide big-endian (?) implementations for the raw types.

from rust_radix_trie.

Albibek avatar Albibek commented on May 30, 2024

Found a problem here.
Trait specifications start to conflict because the existing trait is generic. Specialization RFC could solve it in the most beautiful way, but it's not in stable yet.

As of current situation I can see these choices:

from rust_radix_trie.

Albibek avatar Albibek commented on May 30, 2024

Oh, and one more question: differentiating signed and unsigned types. From the point of view above we don't do the difference, that means i32 and u32 will be converted to same Vec<u8>.
This doesn't seem to me as a big problem, since same tree cannot have multi-typed keys, but I'm probably wrong, so letting you know about that.

from rust_radix_trie.

michaelsproul avatar michaelsproul commented on May 30, 2024

I think we should get rid of the blanket implementation of TrieKey for T where T: Into<Vec<u8>>, so we can write implementations for specific types like you suggest. I don't think we should use an extra trait like IntoKey as that mucks up the type of the trie itself, and creates the signedness issue you mentioned. Having Trie<u32, String> and Trie<i32, String> is more informative than having Trie<Vec<u8>, String>, which is what you get with IntoKey.

Don't worry about breaking API compatibility, we are pre-1.0, so anything goes 😄. To that end, I've recently been restructuring things for improved performance and usability. My new changes are on the new-stuff branch which I hope to merge soon. You should base your changes off this.

I think we should use wrapper enums, or some other strongly-typed thing, so we can have Trie<LittleEndian<u32>, String> and Trie<BigEndian<u32>, String>. If we use the endian-type package we can use the as_bytes() function, see:

https://docs.rs/endian-type/0.1.2/endian_type/struct.LittleEndian.html

from rust_radix_trie.

michaelsproul avatar michaelsproul commented on May 30, 2024

Closed by #22, thanks @Albibek 😄

from rust_radix_trie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.