Giter Site home page Giter Site logo

Support alloc-free operation about mqttrs HOT 3 CLOSED

00imvj00 avatar 00imvj00 commented on July 19, 2024
Support alloc-free operation

from mqttrs.

Comments (3)

MathiasKoch avatar MathiasKoch commented on July 19, 2024

@vincentdephily Did you manage to make any further progress on this? It is something i would really like to see, as this issue is the only reason why all my crates built on top of this requires alloc.. MqttClient, Aws IoT libraries etc.

Anything i can do to help?

I am aiming towards a completely heapless stack, as to know at compile-time i wont run into OOM situations. 100% uptime is crucial in our application.

from mqttrs.

vincentdephily avatar vincentdephily commented on July 19, 2024

I haven't touched this in a while and it isn't on my TODO, but I'm happy to help you implement this.

As I said, some of the work has already been done, by starting to use the Buf(Mut) trait instead of the Bytes(Mut) struct wherever possible. From there, it's basically a matter of 1) passing a stack-allocated buffer such as &[u8] to encode() and decode() and see/fix what breaks 2) switch the crate to no_alloc and see/fix what breaks.

encode() is further along than decode(), and I believe you can already give a stack-allocated &[u8] to encode(), and I think that the rest of the encode is stack-only as well. If I didn't break/remove any of the buf.remaining_mut() checks, this means encode() is already no-alloc.

Fixing the breakage will probably involve giving up on some of Bytes's utility functions. It'll be less elegant but I imagine it's straightforward (Famous Last Words).

Don't hesistate to open a PR before it's ready for merging, if you get stuck somewhere. I'm also reachable on Matrix as @moltonel:matrix.org, and hang out on the Rust channels.

from mqttrs.

MathiasKoch avatar MathiasKoch commented on July 19, 2024

Awesome!
I can confirm that after merging #28, encode() is indeed fully usable in no_alloc.. On to decode() it is.. We will give it a shot, and might give you a ping along the way on Matrix..

How about Strings and Vecs in payload, topic-name etc? Do you guys have preferences, or should we go with something like heapless in no_alloc?

from mqttrs.

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.