Comments (3)
@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.
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.
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)
- `Connect.password` should be `Option<Vec<u8>>` instead of `Option<String>`.
- Refactor using a combined `QosPid` struct. HOT 1
- PacketIdentifier should be NonZeroU16
- Support MQTT5 HOT 8
- Add builder APIs
- Zero-copy encoding and decoding HOT 4
- Write good documentation. HOT 4
- Usage in no_std environments HOT 9
- New release on crates.io? HOT 2
- Serde feature enabled by default (through `std` feature) HOT 2
- Add `mqttrs::decode::check()` method, to see if the packet is decodable? HOT 2
- Proper way to extract packet length? HOT 2
- make every packet clonable.
- Example in README file does not work, cannot find encode/decode in this scope HOT 2
- Purging 0.4.0 in favour of simplicity and little bit of performance cost. HOT 10
- Fresh crates.io release HOT 2
- Unable to implement tokio_util::codec::{Decoder, Encoder} with mqttrs version 0.4 HOT 4
- Trouble Implementing Tokio-util Decoder for MQTT Broker
- Add integration examples with other libraries and runtimes.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mqttrs.