Skip to content

Support #![no_std] without liballoc #58

Description

@tarcieri

I'd like to be able to use is_nfc_quick()/is_nfd_quick() in a context where liballoc isn't available.

It looks like the only thing linking liballoc right now is tinyvec. Would it be possible to make tinyvec into an optional dependency?

Activity

  1. Manishearth commented on May 21, 2020

    @Manishearth
    Member

    tinyvec is necessary because theoretically decompositions and compositions can map to an unbounded number of decomposed # code points. There's probably a small practical limit in what the composition data allows though

  2. tarcieri commented on May 22, 2020

    @tarcieri
    Author

    There's probably a small practical limit in what the composition data allows though

    Perhaps tinyvec::ArrayVec could work? (or could be used on no_std w\o alloc at least)

  3. Manishearth commented on May 22, 2020

    @Manishearth
    Member

    Sure, PRs welcome. Ideally something that switches between arrayvec and a non panicky variant

  4. tarcieri commented on May 22, 2020

    @tarcieri
    Author

    ...arrayvec and a non panicky variant

    Oh, now I see ArrayVec doesn't have any fallible APIs and always panics on overflow. That's not great.

    Elsewhere I use heapless::Vec which does provide fallible APIs, and a trait like this to abstract over heapless::Vec and heap-based data structures (really wish something like this were in core):

    https://docs.rs/veriform/0.1.0/veriform/derive_helpers/trait.TryExtend.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions