Crate sparkplug_rs

Source
Expand description

sparkplug-rs License Latest Version Documentation Issues FOSSA Status

Rust protobuf payload for Sparkplug™. The structs are generated with the protobuf IDL of the Eclipse Tahu project. For more information look at the homepage of the Eclipse Sparkplug project.

§MQTT Topic Names

This crate provides a convenient way to handle MQTT topic names with TopicName.

§JSON

For JSON serialization/deserialization of protobuf messages, instead of adding a dependency on serde, I recommend checking out the protobuf-json-mapping crate. This crate is specifically designed to work with protobuf messages and provides the JSON mapping functionality you likely need, while keeping dependencies minimal and aligned with the protobuf ecosystem. This approach is more lightweight since it avoids bringing in the full serde ecosystem when you only need protobuf-specific JSON handling.

§Examples

let node = TopicName::new_node_message(TopicNamespace::SPBV1_0,
"my_group".to_string(),
NodeMessageType::NBIRTH,
"nodeId".to_string());
assert_eq!(node.to_string(), "spBv1.0/my_group/NBIRTH/nodeId");

let topic: TopicName = TopicName::from_str("spBv1.0/my_group/NBIRTH/nodeId").unwrap();
assert_eq!(topic, node);

License: EPL-2.0

§License

FOSSA Status

Re-exports§

pub use protobuf;
pub use sparkplug_b::*;

Modules§

sparkplug_b
Generated file from sparkplug_b.proto

Structs§

DeviceMessageTypeParseError
NodeMessageTypeParseError
TopicNameParseError
TopicNamespaceParseError

Enums§

DeviceMessageType
Enum for device-message types.
NodeMessageType
Enum for node-message types.
TopicName
Rust representation of a sparkplug™ MQTT topic-name.
TopicNamespace
Enumerator for Sparkplugs™ topic namespace.