Crate paho_mqtt

source ·
Expand description

This is the Eclipse Paho MQTT client library for the Rust language.

Crate Features

Default

  • bundled Builds the Paho C library for the target and automatically links it.

  • ssl Builds the library with OpenSSL support. This allow secure SSL/TLS connections to a broker along with secure websockets. This requires OpenSSL to be installed for the target or using the vendored-ssl feature to build it.

Non-default

  • build_bindgen Build the bindings to the Paho C library for the target. The library ships with a number of pre-built bindings for common targets. For other targets it might be helpful to build the bindings for the specific target platform, especially if the library segfauls due to an improper API.

  • vendored-ssl Download an build OpenSSL for the target.

Logging

The library uses the standard Rust log facility with the target/module “paho_mqtt”.

In addition, the traces from the underlying Paho C library are captured and redirected to the Rust log facility. Since the C library is a bit cryptic and verbose, the output is controlled separately using a “paho_mqtt_c” target/module. The levels for the C library are approximated to suit the Rust filter level selected for it.

The example applications use the simple environment logger which can be controlled by the RUST_LOG environment variable. To set the logging for the two modules, you can do something like:

$ RUST_LOG="pago_mqtt=info,paho_mqtt_c=debug" ./target/debug/examples/async_subscribe
Connecting to the MQTT server at 'mqtt://localhost:1883'...
[2023-09-11T13:26:18Z DEBUG paho_mqtt::c_trace] =========================================================
[2023-09-11T13:26:18Z DEBUG paho_mqtt::c_trace]                    Trace Output
[2023-09-11T13:26:18Z DEBUG paho_mqtt::c_trace] Product name: Eclipse Paho Asynchronous MQTT C Client Library
[2023-09-11T13:26:18Z DEBUG paho_mqtt::c_trace] Version: 1.3.11
...

Re-exports

Modules

  • The asynchronous API The Asynchronous client module for the Paho MQTT Rust client library.
  • The synchronous API This contains the synchronous Client interface for the Paho MQTT Rust library.
  • Definitions for creating user-defined persistence.
  • Options for connecting to the server. Connect options for the Paho MQTT Rust client library.
  • Client creation options
  • Options for disconnecting from the server. Disconnect options for the Paho MQTT Rust client library. This contains the structures to define the options for disconnecting from the MQTT broker/server.
  • The MQTT errors
  • The message object
  • Utility for creating name/value string pair collections (to pass to the C library).
  • MQTT 5v properties. MQTT v5 properties.
  • MQTT v5 Reason Codes The Reason Code module for the Paho MQTT Rust client library.
  • Options for responses coming back from the C lib. Response options for the Paho MQTT Rust client library.
  • Responses coming back from the server. The Token module for the Paho MQTT Rust client library.
  • Connect options for creating secure connections to the server.
  • Utility for creating string collections (to pass to the C library).
  • Options for subscribing to topics MQTT v5 subscribe options for the Paho MQTT Rust client library. These are defined in section 3.8.3.1 of the MQTT v5 spec. The defaults use the behavior that was present in MQTT v3.1.1.
  • Tokens to monitor asynchronous operations The Token module for the Paho MQTT Rust client library.
  • Options for creating topic objects that are associated with a particular server. Objects for manipulating and checking message topics.
  • Code to match MQTT topics to filters that may contain wildcards.
  • Miscelaneous types MQTT support types
  • Connect options for the Last Will and Testament (LWT) message. Last Will and Testament (LWT) options for the Paho MQTT Rust client library.

Macros

Structs

Functions

  • Converts a C integer boolean to a Rust bool
  • Convert a Rust bool to a Paho C integer boolean

Type Aliases

  • Generic type for arbitrary user-supplied data.