quartiq / minimq

Minimal no_std MQTT v5.0 client implementation
MIT License
146 stars 16 forks source link

Refactoring publication to support zero-copy serialization #144

Closed ryan-summers closed 1 year ago

ryan-summers commented 1 year ago

This PR is designed to allow an end user to provide a Publication message with a yet-to-be-serialized payload. This then allows them to serialize their payload directly into the MQTT TX buffer, which eliminates the need for them serializing and then copying it over into the MQTT payload.

Example:

client.publish(Publication::new_deferred(|buf| settings.get(key, buf)));