Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
A Rust interface to the Mosquitto MQTT broker client
Mosquitto is a popular MQTT broker implemented in C. Although there are pure Rust MQTT clients, it is still useful to have a binding to the Mosquitto client.
The basic story is that you connect to a broker, subscribing to topics that interest you and publishing messages on a particular topic. The messages may be any arbitrary bytes, but this implementation does require that the topics themselves be UTF-8. The C API is based on callbacks, which are mapped onto Rust closures.
The Mosquitto client is thread-safe, so you can publish from one thread and listen for the messages on another. This example demonstrates mosquitto-client usage:
extern crate mosquitto_client_wrapper as mosq; use Mosquitto; use ;
Mosquitto struct is a thin wrapper around the C pointer we get from the client.
Clone + Send + Sync, so we can pass it to a thread which simply publishes some
bytes and waits; at the end of the thread we explicitly disconnect.
Callbacks handler struct is separate, to avoid antagonizing the borrow checker.
It is created by the
callbacks method and is generic over some data (accessed as the
Whenever an event occurs, the callback will be passed a mutable reference to that data, and
event-specific data - in this case a message struct.
loop_until_disconnect is a relative of
loop_forever which ends without error if we
explicitly disconnect from the broker.
bundled (on by default)
This feature will automatically download and build the mosquitto client library. By default, the master branch is taken. This could be overwritten with the following variables:
MOSQUITTO_GIT_URLUrl of the git repository; by default https://github.com/eclipse/mosquitto.git
MOSQUITTO_GIT_HASHGit hash to checkout for the build; by default none
The library could be cross-compiled. The following env parameters have to be set for that:
MOSQUITTO_CROSS_COMPILERdefault none, e.g.