Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Paho MQTT Rust Language Library

Hello All,

The Paho Rust Language library is now just about functionally complete. With the addition of user-defined persistence this week, the Rust library now has full coverage of the capabilities of the underlying Paho C library for MQTT 3.x. It's still fairly messy, lacks full error detection, and has an evolving API, but it is quickly progressing towards a release candidate. I'm still on track to have an initial release by February - and then on to MQTT v5 by June.

I continue to be intrigued by the Rust language. The compiler complains, moans, and nags you into writing better low-level code. It simply doesn't allow you to get away with some of the sloppy code that you get from C/C++.

It's like having Grandma doing your code reviews.


On 11/07/2017 09:07 AM, Frank Pagliughi wrote:
Hello Ian,

I found a number of MQTT libraries for Rust, but none seemed complete or up-to-date. Strangely, while researching how to wrap C library calls in Rust, I repeatedly found questions by people who were attempting to wrap the Mosquitto API. So it seems that there is some MQTT interest in the Rust crowd.

I've found Rust to be very intriguing. It's a compiled, typed language, and overlaps the space where C and C++ would be used. A primary feature is its concept of memory ownership and borrowing whereby the compiler tracks references to memory distinguishing between mutable and immutable variations - even across threads - to prevents race conditions. The compiler tends to nag about these things, like an overbearing grandmother, forcing you to promise you'll never do bad things again. But in the end, when you grow up, you know she's right.

I recommend people have a look at Rust. If nothing else, it will make you reconsider the way you program C and C++.

Working with Rust has once again brought up the concept of "const-ness" in the C library. If the library receives a buffer which it will not change, it should mark the buffer as being "const" (as const void* or const char*, etc). It has been moving in that direction for a while now, but we should give a review to make sure that it's consistent. I can help with that.

My intent was to knock out an initial, stable, version that worked with the existing Paho 1.3, but I definitely intend follow it with the MQTT v5 additions. If you're ready to get started, then perhaps some of that work will happen in parallel.

Let's start to discuss work and schedules.


On 11/07/2017 06:32 AM, Ian Craggs wrote:
Hi Frank,

thanks, that's great progress!  Were there any existing MQTT clients for Rust?

Can you give an idea of when one might consider using the Rust language - an alternative to C?

I intend to start working on updates to the C client for MQTT V5 soon, I don't know if you'd like to accommodate those changes at the same time?  I haven't formulated the API changes yet - I'll need to do that first.


On 07/11/2017 05:08, Frank Pagliughi wrote:
Hey All,

I've started uploading some code for a new Paho Rust Language library at:

The code is initially going into an "incubator" branch to indicate that it is highly unstable and will be changing quickly over the next few weeks. It's a wrapper around the Paho C library, and the first version will target the Paho 1.3 release for MQTT v3.1 and 3.1.1.

It's very early days, but the library can connect (via TCP or SSL/TLS), publish, subscribe, and disconnect cleanly using an asynchronous interface. I'm currently developing on Linux x86_64, but other platforms that are supported by Rust and Paho C should be relatively straightforward. At this point, the library sorely lacks error handling, documentation, and stability.

I'm hoping to stabilize the API by the end of the year and release in early 2018.

I'm a relative newcomer to Rust (as, apparently, are 97% or Rust users), so am hoping to get advice and guidance on the API from others having more experience with the language. But I also hope to keep it familiar to existing Paho users.

So far, I'm fairly impressed with Rust. It looks like an interesting language for some MQTT programming. Fast and safe.

Frank Pagliughi
paho-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top