Giter VIP home page Giter VIP logo

Comments (5)

NickeZ avatar NickeZ commented on August 21, 2024 1

Thanks! I took a quick look and it seems like you have some Strings and Cow::borroweds which are not trivial to get rid of. Otherwise it seems like just dropping in use core as std will work. Looking forward to no_std support!

from data-encoding.

ia0 avatar ia0 commented on August 21, 2024

Thanks for the suggestion! This is indeed something I had planned to do but never started because I didn't know if it would be useful to anyone.

Do you have any time constraint regarding this feature? Without any particular constraint, I'll try to look into it before the end of the year. But I could prioritize if necessary.

from data-encoding.

ia0 avatar ia0 commented on August 21, 2024

Cool! Thanks for having looked into it. I guess the no-std feature is going to change the API a bit. The 2 things I would see (according to your findings) are:

  1. Don't use String, only u8 buffers.
  2. Don't support creation of encodings at runtime.

I guess the first point is not an issue. For the second, I'm assuming no-std crates won't generate encodings at runtime but instead create them at compile-time.

from data-encoding.

NickeZ avatar NickeZ commented on August 21, 2024

I guess the first point is not an issue. For the second, I'm assuming no-std crates won't generate encodings at runtime but instead create them at compile-time.

  1. Yeah, that is the common modus operandi in the world of embedded. We tend to use mostly stack allocated buffers.
  2. It depends. Could you create them without heap allocation? I mean normally you simply put structs on the stack. In the end I think you are right and the most common use cases is to create them at compile time anyway.

Many embedded systems, like the one I compile for (cortex-m4), actually have a heap but are still no_std due to missing file-system support and so on. I'm not 100% sure how, but you could use the alloc crate to still use Strings and Cow::borroweds. Maybe that is a good initial goal? That would actually allow me to use your crate.

Thanks again!

from data-encoding.

ia0 avatar ia0 commented on August 21, 2024

Hi @NickeZ,

I've written #31 to add an std (which is the default and implies alloc) and an alloc feature to the data-encoding crate. If you would have the time to test (or even review) the PR before I commit it, I would greatly appreciate. But I would understand if you don't have the time. I'll commit in 2 weeks otherwise and probably release before the end of the year.

You can test the PR by changing the data-encoding dependency in your Cargo.toml with:

[dependencies.data-encoding]
git = "https://github.com/ia0/data-encoding"
branch = "nostd"
default-features = false
features = ["alloc"]  # Omit this line if you don't have an allocator.

Thanks!
Julien

from data-encoding.

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.