Code Monkey home page Code Monkey logo

Comments (4)

joseluis avatar joseluis commented on September 23, 2024

The main hurdle I see is that the new const SIZE parameter must be usize since it can't be casted later to u8, so if there has to be a 255 limit it may have to be checked dynamically.

from arraystring.

joseluis avatar joseluis commented on September 23, 2024

The main problem of using arrays of const generic size, is that we must use usize everywhere, since casting from the generic argument is not allowed yet. That in turn increases the minimum size of ArrayString from 1 byte to 4 bytes in 64-bit systems. 16 bytes minimum.

The crate would therefore become less useful for small sized static strings, which I believe is the most important usecase.

I'm closing this. Until the necessary ability to cast const generic attributes arrives to stable I don't think there's a better solution that the current one.

from arraystring.

paulocsanz avatar paulocsanz commented on September 23, 2024

Somehow I only got notified about this issue today.

The maximum size is not a restriction and I'm open to those changes. But honestly, I haven't put a thought into this crate in a couple of years.

So if you can provide a PR with the changes I'm willing to review and accept it.

typenum and having to manually implement the trait for each of its types slows compilation down heavily, so removing it would be great.

from arraystring.

Wicpar avatar Wicpar commented on September 23, 2024

Ok, i did suggest something but it depended on generic const expr which is still unstable. Even if the size is > 255, all operation sizes are runtype checked anyway so if N > 255 it's just gonne fail at runtime like if it was N = 255.

from arraystring.

Related Issues (7)

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.