Rust

This guide provides a walk-through of how to install the latest version of Rust and Cargo along with the MQTT Client library.‌

Installing Rust

‌Install Rust and the package manager Cargo by running the following command:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Check the installation and Rust version:

rustc --versionrustc 1.46.0 (04488afe3 2020-08-24)

The modifications toPATHmay not take effect until the console is restarted, or the user is logged out.‌

Installing MQTT Client

Create a new Project:

cargo new project-name

Add dependency by editing the Cargo.toml file:

[dependencies]
paho-mqtt = {git = "https://github.com/eclipse/paho.mqtt.rust", branch = "master"}
futures = { version = "0.3", features = ["compat"] }

Build the project:

cargo build

Run the program:

cargo run

Connect Device

Start connecting devices by following the guide :